diff --git a/CHANGELOG.md b/CHANGELOG.md index e1b0ebf8c0e8..40815a393f3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/packages/jest-cli/bin/jest.js b/packages/jest-cli/bin/jest.js index fc6308c8d2cf..146fb2c4019b 100755 --- a/packages/jest-cli/bin/jest.js +++ b/packages/jest-cli/bin/jest.js @@ -13,5 +13,5 @@ if (!importLocal(__filename)) { process.env.NODE_ENV = 'test'; } - require('../build/cli').run(); + require('..').run(); } diff --git a/packages/jest-repl/bin/jest-repl.js b/packages/jest-repl/bin/jest-repl.js index 36b7a229fd58..3a2251a559dd 100755 --- a/packages/jest-repl/bin/jest-repl.js +++ b/packages/jest-repl/bin/jest-repl.js @@ -10,4 +10,4 @@ if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'test'; } -require('../build/cli')(); +require('..').repl(); diff --git a/packages/jest-repl/bin/jest-runtime-cli.js b/packages/jest-repl/bin/jest-runtime-cli.js index c54353904cd7..ebbbcb649f36 100755 --- a/packages/jest-repl/bin/jest-runtime-cli.js +++ b/packages/jest-repl/bin/jest-runtime-cli.js @@ -10,4 +10,4 @@ if (process.env.NODE_ENV == null) { process.env.NODE_ENV = 'test'; } -require('../build/cli/runtime-cli').run(); +require('..').runtime(); diff --git a/packages/jest-repl/package.json b/packages/jest-repl/package.json index c2512a662ee7..3d09b2b15b1f 100644 --- a/packages/jest-repl/package.json +++ b/packages/jest-repl/package.json @@ -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", diff --git a/packages/jest-repl/src/index.ts b/packages/jest-repl/src/index.ts new file mode 100644 index 000000000000..adf5259d1e22 --- /dev/null +++ b/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';