Skip to content

Commit 8bb6e01

Browse files
author
Mariusz Pasinski
committed
feat: add test case for addon that "escaped" its package
In this particular case we don't want to get packageName="sub-package" with path "../addon-2.node"
1 parent 6cfbc52 commit 8bb6e01

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

packages/host/src/node/babel-plugin/plugin.test.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ describe("plugin", () => {
2727
const addon = require('../addon-1.node');
2828
console.log(addon);
2929
`,
30+
"sub-directory-3/package.json": `{ "name": "sub-package" }`,
31+
"sub-directory-3/addon-outside.js": `
32+
const addon = require('../addon-2.node');
33+
console.log(addon);
34+
`,
3035
"addon-1-bindings.js": `
3136
const addon = require('bindings')('addon-1');
3237
console.log(addon);
@@ -66,6 +71,7 @@ describe("plugin", () => {
6671
runTestCase({ resolvedPath: "./addon-1.node", originalPath: "./addon-1.node", inputFile: "./addon-1.js" });
6772
runTestCase({ resolvedPath: "./addon-2.node", originalPath: "./addon-2.node", inputFile: "./addon-2.js" });
6873
runTestCase({ resolvedPath: "./addon-1.node", originalPath: "../addon-1.node", inputFile: "./sub-directory/addon-1.js" });
74+
runTestCase({ resolvedPath: "./addon-2.node", originalPath: "../addon-2.node", inputFile: "./sub-directory-3/addon-outside.js" });
6975
runTestCase({ resolvedPath: "./addon-1.node", originalPath: "addon-1", inputFile: "./addon-1-bindings.js" });
7076

7177
{

0 commit comments

Comments
 (0)