Skip to content
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Fixes

- `[jest-runtime]` Fix issue where user cannot utilize dynamic import despite specifying `--experimental-vm-modules` Node option ([#15842](https://github.com/jestjs/jest/pull/15842))
- `[jest-config]` Fix issue where custom reporters not loaded from legacy global module folder, i.e. `$HOME/.node_libraries` ([#15852](https://github.com/jestjs/jest/pull/15852))

## 30.2.0

Expand Down
24 changes: 24 additions & 0 deletions e2e/__tests__/customReporters.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,28 @@
expect(stderr).toMatch(/ON_RUN_START_ERROR/);
expect(exitCode).toBe(1);
});

test('supports custom reporter stored in legacy module path, i.e. $HOME/.node_libraries', () => {
writeFiles(DIR, {
'__tests__/test.test.js': "test('test', () => {});",
'package.json': JSON.stringify({
jest: {
reporters: ['@org/custom-reporter'],
},
}),
'fakeHome/.node_libraries/@org/custom-reporter/index.js': `

Check failure on line 191 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Static Checks (Lint, Typecheck, Yarn Validate)

Expected object keys to be in ascending order. 'fakeHome/.node_libraries/@org/custom-reporter/index.js' should be before 'package.json'
export default class Reporter {
onRunStart() {
throw new Error('ON_RUN_START_ERROR');
}
};
`,
});

const {stderr, exitCode} = runJest(DIR, undefined, {
env: {HOME: path.resolve(DIR, 'fakeHome')},
});
expect(stderr).toMatch(/ON_RUN_START_ERROR/);

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Ubuntu with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/tmp/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/home/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/home/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Ubuntu with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/tmp/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/home/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/home/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Ubuntu with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/tmp/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/home/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/home/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v24.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v24.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v24.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / macOS with shard 1/3 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/Users/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/Users/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / macOS with shard 1/3 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/Users/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/Users/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / macOS with shard 1/3 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "/private/var/folders/q0/wmf37v850txck86cpnvwm_zw0000gn/T/custom-reporters-test-dir/fakeHome/.node_libraries/@org/custom-reporter/index.js:1 export default class Reporter { ^^^^^^· SyntaxError: Unexpected token 'export' at internalCompileFunction (node:internal/vm:76:18) at wrapSafe (node:internal/modules/cjs/loader:1283:20) at Module._compile (node:internal/modules/cjs/loader:1328:27) at Module._extensions..js (node:internal/modules/cjs/loader:1422:10) at Module.load (node:internal/modules/cjs/loader:1203:32) at Module._load (node:internal/modules/cjs/loader:1019:12) at Module.require (node:internal/modules/cjs/loader:1231:19) at require (node:internal/modules/helpers:177:18) at requireOrImportModule (/Users/runner/work/jest/jest/packages/jest-util/build/index.js:1010:28) at TestScheduler._addCustomReporter (/Users/runner/work/jest/jest/packages/jest-core/build/index.js:1222:68)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v20.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v20.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v20.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v22.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v22.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v22.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node LTS using jest-jasmine2

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node LTS using jest-jasmine2

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node LTS using jest-jasmine2

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)

Check failure on line 203 in e2e/__tests__/customReporters.test.ts

View workflow job for this annotation

GitHub Actions / Windows with shard 2/4 / Node v18.x

Custom Reporters Integration › supports custom reporter stored in legacy module path

expect(received).toMatch(expected) Expected pattern: /ON_RUN_START_ERROR/ Received string: "Error: Could not resolve a module for a custom reporter. Module name: @org/custom-reporter at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1556:15 at Array.map (<anonymous>) at normalizeReporters (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1539:20) at D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1765:17 at Array.reduce (<anonymous>) at normalize (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1663:14) at readConfig (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:928:36) at async readConfigs (D:\\a\\jest\\jest\\packages\\jest-config\\build\\index.js:1168:26) at async runCLI (D:\\a\\jest\\jest\\packages\\jest-core\\build\\index.js:1407:7) at async Object.run (D:\\a\\jest\\jest\\packages\\jest-cli\\build\\index.js:656:9)" at Object.toMatch (e2e/__tests__/customReporters.test.ts:203:20)
expect(exitCode).toBe(1);
});
});
18 changes: 15 additions & 3 deletions packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
replacePathSepForGlob,
requireOrImportModule,
tryRealpath,
specialChars,

Check failure on line 30 in packages/jest-config/src/normalize.ts

View workflow job for this annotation

GitHub Actions / Static Checks (Lint, Typecheck, Yarn Validate)

Member 'specialChars' of the import declaration should be sorted alphabetically
} from 'jest-util';
import {ValidationError, validate} from 'jest-validate';
import DEFAULT_CONFIG from './Defaults';
Expand Down Expand Up @@ -169,7 +170,9 @@
);
}
throw createConfigError(
` Preset ${chalk.bold(presetPath)} not found relative to rootDir ${chalk.bold(options.rootDir)}.`,
` Preset ${chalk.bold(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is autogenerated by prettier

presetPath,
)} not found relative to rootDir ${chalk.bold(options.rootDir)}.`,
);
}
throw createConfigError(
Expand Down Expand Up @@ -378,8 +381,17 @@
);

if (!['default', 'github-actions', 'summary'].includes(reporterPath)) {
// There's a chance that users store custom reporter in legacy module paths
// such as $HOME/.node_libraries
const homeDir = specialChars.isWindows
? process.env.USERPROFILE
: process.env.HOME;
const legacyModulePaths = homeDir
? [path.resolve(homeDir, '.node_libraries')]
: undefined;
const reporter = Resolver.findNodeModule(reporterPath, {
basedir: rootDir,
paths: legacyModulePaths,
});
if (!reporter) {
throw new Resolver.ModuleNotFoundError(
Expand Down Expand Up @@ -1087,8 +1099,8 @@
newOptions.ci && !argv.updateSnapshot
? 'none'
: argv.updateSnapshot
? 'all'
: 'new';
? 'all'

Check failure on line 1102 in packages/jest-config/src/normalize.ts

View workflow job for this annotation

GitHub Actions / Static Checks (Lint, Typecheck, Yarn Validate)

Insert `··`
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ditto

: 'new';

Check failure on line 1103 in packages/jest-config/src/normalize.ts

View workflow job for this annotation

GitHub Actions / Static Checks (Lint, Typecheck, Yarn Validate)

Insert `··`

newOptions.maxConcurrency = Number.parseInt(
newOptions.maxConcurrency as unknown as string,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-util/src/specialChars.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* LICENSE file in the root directory of this source tree.
*/

const isWindows = process.platform === 'win32';
export const isWindows = process.platform === 'win32';

export const ARROW = ' \u203A ';
export const ICONS = {
Expand Down
Loading