Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: binary scripts should use package exports #12315

Merged
merged 3 commits into from Feb 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion CHANGELOG.md
Expand Up @@ -7,7 +7,8 @@
### Fixes

- `[expect]` Add type definitions for asymmetric `closeTo` matcher ([#12304](https://github.com/facebook/jest/pull/12304))
- `[jest-repl]` Make module importable ([#12311](https://github.com/facebook/jest/pull/12311))
- `[jest-cli]` Load binary via exported API ([#12315](https://github.com/facebook/jest/pull/12315))
- `[jest-repl]` Make module importable ([#12311](https://github.com/facebook/jest/pull/12311) & [#12315](https://github.com/facebook/jest/pull/12315))

### Chore & Maintenance

Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/bin/jest.js
Expand Up @@ -13,5 +13,5 @@ if (!importLocal(__filename)) {
process.env.NODE_ENV = 'test';
}

require('../build/cli').run();
require('..').run();
}
2 changes: 1 addition & 1 deletion packages/jest-repl/bin/jest-repl.js
Expand Up @@ -10,4 +10,4 @@ if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = 'test';
}

require('../build/cli')();
require('..').repl();
2 changes: 1 addition & 1 deletion packages/jest-repl/bin/jest-runtime-cli.js
Expand Up @@ -10,4 +10,4 @@ if (process.env.NODE_ENV == null) {
process.env.NODE_ENV = 'test';
}

require('../build/cli/runtime-cli').run();
require('..').runtime();
8 changes: 4 additions & 4 deletions packages/jest-repl/package.json
Expand Up @@ -7,12 +7,12 @@
"directory": "packages/jest-repl"
},
"license": "MIT",
"main": "./build/cli/index.js",
"types": "./build/cli/index.d.ts",
"main": "./build/index.js",
"types": "./build/index.d.ts",
"exports": {
".": {
"types": "./build/cli/index.d.ts",
"default": "./build/cli/index.js"
"types": "./build/index.d.ts",
"default": "./build/index.js"
},
"./package.json": "./package.json",
"./bin/jest-repl": "./bin/jest-repl.js",
Expand Down
11 changes: 11 additions & 0 deletions packages/jest-repl/src/index.ts
@@ -0,0 +1,11 @@
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/

import replImport = require('./cli');

export const repl = replImport;
export {run as runtime} from './cli/runtime-cli';