Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a640584

Browse files
authored
fix: move binary file declaration from runtime to repl (#10925)
1 parent 09506a3 commit a640584

File tree

5 files changed

+21
-8
lines changed

5 files changed

+21
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
- `[jest-haste-map]` [**BREAKING**] Migrate to ESM ([#10875](https://github.com/facebook/jest/pull/10875))
5252
- `[jest-haste-map]` [**BREAKING**] Remove support for deprecated option `ignorePattern` as function ([#10348](https://github.com/facebook/jest/pull/10348))
5353
- `[jest-jasmine2]` [**BREAKING**] Migrate to ESM ([#10906](https://github.com/facebook/jest/pull/10906))
54-
- `[jest-repl, jest-runtime]` [**BREAKING**] Move the `jest-runtime` CLI into `jest-repl` ([#10016](https://github.com/facebook/jest/pull/10016))
54+
- `[jest-repl, jest-runtime]` [**BREAKING**] Move the `jest-runtime` CLI into `jest-repl` ([#10016](https://github.com/facebook/jest/pull/10016) & [#10925](https://github.com/facebook/jest/pull/10925))
5555
- `[jest-resolve]` [**BREAKING**] Migrate to ESM ([#10688](https://github.com/facebook/jest/pull/10688))
5656
- `[jest-resolve-dependencies]` [**BREAKING**] Migrate to ESM ([#10876](https://github.com/facebook/jest/pull/10876))
5757
- `[jest-mock]` [**BREAKING**] Migrate to ESM ([#10887](https://github.com/facebook/jest/pull/10887))

packages/jest-repl/package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
"exports": {
1313
".": "./build/index.js",
1414
"./package.json": "./package.json",
15-
"./bin/jest-repl": "./bin/jest-repl.js"
15+
"./bin/jest-repl": "./bin/jest-repl.js",
16+
"./bin/jest-runtime-cli": "./bin/jest-runtime-cli.js"
1617
},
1718
"dependencies": {
1819
"@jest/console": "^27.0.0-next.0",
@@ -32,7 +33,10 @@
3233
"@types/yargs": "^15.0.0",
3334
"execa": "^5.0.0"
3435
},
35-
"bin": "./bin/jest-repl.js",
36+
"bin": {
37+
"jest-repl": "./bin/jest-repl.js",
38+
"jest-runtime": "./bin/jest-runtime-cli.js"
39+
},
3640
"engines": {
3741
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
3842
},

packages/jest-runtime/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@
1111
"types": "./build/index.d.ts",
1212
"exports": {
1313
".": "./build/index.js",
14-
"./package.json": "./package.json",
15-
"./bin/jest-runtime": "./bin/jest-runtime.js"
14+
"./package.json": "./package.json"
1615
},
1716
"dependencies": {
1817
"@jest/console": "^27.0.0-next.0",
@@ -52,7 +51,6 @@
5251
"jest-environment-node": "^27.0.0-next.0",
5352
"jest-snapshot-serializer-raw": "^1.1.0"
5453
},
55-
"bin": "./bin/jest-runtime.js",
5654
"engines": {
5755
"node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0"
5856
},

scripts/buildUtils.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,18 @@ module.exports.getPackages = function getPackages() {
5555
},
5656
`Package ${pkg.name} does not export correct files`,
5757
);
58+
59+
if (pkg.bin) {
60+
Object.entries(pkg.bin).forEach(([binName, binPath]) => {
61+
const fullBinPath = path.resolve(packageDir, binPath);
62+
63+
if (!fs.existsSync(fullBinPath)) {
64+
throw new Error(
65+
`Binary in package ${pkg.name} with name "${binName}" at ${binPath} does not exist`,
66+
);
67+
}
68+
});
69+
}
5870
});
5971

6072
return packages;

yarn.lock

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11988,6 +11988,7 @@ fsevents@^1.2.7:
1198811988
yargs: ^16.0.3
1198911989
bin:
1199011990
jest-repl: ./bin/jest-repl.js
11991+
jest-runtime: ./bin/jest-runtime-cli.js
1199111992
languageName: unknown
1199211993
linkType: soft
1199311994

@@ -12104,8 +12105,6 @@ fsevents@^1.2.7:
1210412105
slash: ^3.0.0
1210512106
strip-bom: ^4.0.0
1210612107
yargs: ^16.0.3
12107-
bin:
12108-
jest-runtime: ./bin/jest-runtime.js
1210912108
languageName: unknown
1211012109
linkType: soft
1211112110

0 commit comments

Comments
 (0)