Skip to content

Commit 00eb9f2

Browse files
authored
fix: linked module resolution (#18)
1 parent 83862ab commit 00eb9f2

File tree

14 files changed

+160
-31
lines changed

14 files changed

+160
-31
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@ jobs:
3535
- name: Bundle project
3636
run: npm run build
3737
working-directory: __fixtures__/simple-project
38+
- name: Verify the bundle
39+
run: npm run verify
40+
working-directory: __fixtures__/simple-project
3841
- name: Set up bundled project
3942
uses: bahmutov/npm-install@v1
4043
with:
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@linked-dependencies/bundled",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"private": true,
6+
"exports": {
7+
"./reporter": "./reporters/default.js"
8+
}
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = class LinkedLocalReporter {};
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"name": "@linked-dependencies/external",
3+
"version": "1.0.0",
4+
"main": "index.js",
5+
"private": true,
6+
"exports": {
7+
"./reporter": "./reporters/default.js"
8+
}
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
module.exports = class LinkedExternalReporter {};

__fixtures__/linked-local-reporter/index.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

__fixtures__/linked-local-reporter/package.json

Lines changed: 0 additions & 6 deletions
This file was deleted.

__fixtures__/simple-project/.esbuild-jestrc.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module.exports = {
66
"outExtension": {
77
".js": ".mjs"
88
},
9-
"external": ["chalk", "dtrace-provider"],
9+
"external": ["chalk", "dtrace-provider", "@linked-dependencies/external"],
1010
},
1111
"preTransform": (path, contents) => {
1212
if (path.includes('lodash/noop')) {
@@ -16,6 +16,9 @@ module.exports = {
1616
return contents;
1717
},
1818
"package": {
19-
"name": "custom-name"
19+
"name": "custom-name",
20+
"dependencies": {
21+
"@linked-dependencies/external": "../linked-dependencies/external",
22+
}
2023
}
2124
};

__fixtures__/simple-project/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ module.exports = {
55
setupFilesAfterEnv: ['lodash/noop'],
66
reporters: [
77
'default',
8-
'linked-local-reporter',
8+
'@linked-dependencies/bundled/reporter',
9+
'@linked-dependencies/external/reporter',
910
'<rootDir>/customReporter.js',
1011
],
1112
testMatch: [

__fixtures__/simple-project/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,17 @@
55
"main": "index.js",
66
"scripts": {
77
"build": "esbuild-jest",
8-
"test": "jest"
8+
"test": "jest",
9+
"verify": "node verify.js"
910
},
1011
"devDependencies": {
12+
"@linked-dependencies/bundled": "../linked-dependencies/bundled",
13+
"@linked-dependencies/external": "../linked-dependencies/external",
1114
"esbuild": "^0.19.8",
1215
"esbuild-jest-cli": "../..",
1316
"jest": "^29.5.0",
1417
"jest-environment-emit": "^1.0.3",
1518
"jest-allure2-reporter": "^2.0.0-beta.1",
16-
"linked-local-reporter": "../linked-local-reporter",
1719
"lodash": "^4.17.21"
1820
}
1921
}

0 commit comments

Comments
 (0)