Skip to content

Commit 9aa9060

Browse files
authored
feat: Show rootDir in error message when a preset fails to load (#15194)
1 parent 14d305b commit 9aa9060

File tree

3 files changed

+3
-2
lines changed

3 files changed

+3
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
- `[jest-config]` Loads config file from provided path in `package.json` ([#14044](https://github.com/facebook/jest/pull/14044))
1414
- `[jest-config]` Allow loading `jest.config.cts` files ([#14070](https://github.com/facebook/jest/pull/14070))
1515
- `[jest-config]` Added an option to disable `ts-node` typechecking ([#15161](https://github.com/jestjs/jest/pull/15161))
16+
- `[jest-config]` Show `rootDir` in error message when a `preset` fails to load ([#15194](https://github.com/jestjs/jest/pull/15194))
1617
- `[@jest/core]` Group together open handles with the same stack trace ([#13417](https://github.com/jestjs/jest/pull/13417), & [#14789](https://github.com/jestjs/jest/pull/14789))
1718
- `[@jest/core]` Add `perfStats` to surface test setup overhead ([#14622](https://github.com/jestjs/jest/pull/14622))
1819
- `[@jest/core]` [**BREAKING**] Changed `--filter` to accept an object with shape `{ filtered: Array<string> }` to match [documentation](https://jestjs.io/docs/cli#--filterfile) ([#13319](https://github.com/jestjs/jest/pull/13319))

packages/jest-config/src/__tests__/__snapshots__/normalize.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ exports[`preset throws when module was found but no "jest-preset.js" or "jest-pr
367367
exports[`preset throws when preset not found 1`] = `
368368
"<red><bold><bold>● </intensity><bold>Validation Error</intensity>:</color>
369369
<red></color>
370-
<red> Preset <bold>doesnt-exist</intensity> not found.</color>
370+
<red> Preset <bold>doesnt-exist</intensity> not found relative to rootDir <bold>/root/path/foo</intensity>.</color>
371371
<red></color>
372372
<red> <bold>Configuration Documentation:</intensity></color>
373373
<red> https://jestjs.io/docs/configuration</color>

packages/jest-config/src/normalize.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ const setupPreset = async (
169169
);
170170
}
171171
throw createConfigError(
172-
` Preset ${chalk.bold(presetPath)} not found.`,
172+
` Preset ${chalk.bold(presetPath)} not found relative to rootDir ${chalk.bold(options.rootDir)}.`,
173173
);
174174
}
175175
throw createConfigError(

0 commit comments

Comments
 (0)