Skip to content

Commit

Permalink
fix: add ESM exports of all modules manually (#14661)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimenB authored Oct 30, 2023
1 parent f99213d commit 79a4ff4
Show file tree
Hide file tree
Showing 58 changed files with 156 additions and 29 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,14 @@

### Performance

- `[*]` [**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348) & [#14550](https://github.com/jestjs/jest/pull/14550))
- `[*]` [**BREAKING**] Bundle all of Jest's modules into `index.js` ([#12348](https://github.com/jestjs/jest/pull/12348), [#14550](https://github.com/jestjs/jest/pull/14550) & [#14661](https://github.com/jestjs/jest/pull/14661))

### Chore & Maintenance

- `[*]` [**BREAKING**] Drop support for Node.js versions 14 and 19 ([#14460](https://github.com/jestjs/jest/pull/14460))
- `[*]` [**BREAKING**] Drop support for `typescript@4.3`, minimum version is now `5.0` ([#14542](https://github.com/facebook/jest/pull/14542))
- `[*]` Depend on exact versions of monorepo dependencies instead of `^` range ([#14553](https://github.com/facebook/jest/pull/14553))
- `[*]` [**BREAKING**] Add ESM wrapper for all of Jest's modules ([#14661](https://github.com/jestjs/jest/pull/14661))
- `[babel-jest, babel-preset-jest]` [**BREAKING**] Increase peer dependency of `@babel/core` to `^7.11` ([#14109](https://github.com/jestjs/jest/pull/14109))
- `[jest-cli, jest-config, @jest/types]` [**BREAKING**] Remove deprecated `--init` argument ([#14490](https://github.com/jestjs/jest/pull/14490))
- `[docs]` Fix typos in `CHANGELOG.md` and `packages/jest-validate/README.md` ([#14640](https://github.com/jestjs/jest/pull/14640))
Expand Down
2 changes: 1 addition & 1 deletion e2e/custom-esm-test-sequencer/testSequencer.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import Sequencer from '@jest/test-sequencer';

export default class CustomSequencer extends Sequencer.default {
export default class CustomSequencer extends Sequencer {
sort(tests) {
const copyTests = Array.from(tests);
return copyTests.sort((testA, testB) => (testA.path > testB.path ? 1 : -1));
Expand Down
4 changes: 1 addition & 3 deletions e2e/global-setup-esm/setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import * as crypto from 'crypto';
import * as os from 'os';
import * as path from 'path';
import fs from 'graceful-fs';
import jestUtil from 'jest-util';

const {createDirectory} = jestUtil;
import {createDirectory} from 'jest-util';

const DIR = path.join(os.tmpdir(), 'jest-global-setup-esm');

Expand Down
4 changes: 1 addition & 3 deletions e2e/global-teardown-esm/teardown.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import * as crypto from 'crypto';
import * as os from 'os';
import * as path from 'path';
import fs from 'graceful-fs';
import jestUtil from 'jest-util';

const {createDirectory} = jestUtil;
import {createDirectory} from 'jest-util';

const DIR = path.join(os.tmpdir(), 'jest-global-teardown-esm');

Expand Down
4 changes: 1 addition & 3 deletions e2e/transform/transform-esm-runner/runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

import testResult from '@jest/test-result';

const {createEmptyTestResult} = testResult;
import {createEmptyTestResult} from '@jest/test-result';

export default class BaseTestRunner {
constructor(globalConfig, context) {
Expand Down
3 changes: 1 addition & 2 deletions e2e/transform/transform-esm-testrunner/test-runner.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import testResult from '@jest/test-result';

const {createEmptyTestResult} = testResult;
import {createEmptyTestResult} from '@jest/test-result';

export default async function testRunner(
globalConfig,
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"rimraf": "^5.0.0",
"semver": "^7.5.3",
"slash": "^3.0.0",
"string-length": "^4.0.1",
"strip-ansi": "^6.0.0",
"strip-json-comments": "^3.1.1",
"tempy": "^1.0.0",
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/babel-plugin-jest-hoist/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/create-jest/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/diff-sequences/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/expect-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-changed-files/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-circus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-console/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-create-cache-key-function/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-diff/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-docblock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-each/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-environment-jsdom/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-environment-node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-expect/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-fake-timers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-get-type/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-haste-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-jasmine2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-leak-detector/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-matcher-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-message-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-mock/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-phabricator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-regex-util/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-repl/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json",
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-reporters/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-resolve-dependencies/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-resolve/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
2 changes: 2 additions & 0 deletions packages/jest-runtime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
"exports": {
".": {
"types": "./build/index.d.ts",
"require": "./build/index.js",
"import": "./build/index.mjs",
"default": "./build/index.js"
},
"./package.json": "./package.json"
Expand Down
Loading

0 comments on commit 79a4ff4

Please sign in to comment.