Skip to content

Commit

Permalink
feat: Show rootDir in error message when a preset fails to load (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
askoufis authored Jul 21, 2024
1 parent 14d305b commit 9aa9060
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- `[jest-config]` Loads config file from provided path in `package.json` ([#14044](https://github.com/facebook/jest/pull/14044))
- `[jest-config]` Allow loading `jest.config.cts` files ([#14070](https://github.com/facebook/jest/pull/14070))
- `[jest-config]` Added an option to disable `ts-node` typechecking ([#15161](https://github.com/jestjs/jest/pull/15161))
- `[jest-config]` Show `rootDir` in error message when a `preset` fails to load ([#15194](https://github.com/jestjs/jest/pull/15194))
- `[@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))
- `[@jest/core]` Add `perfStats` to surface test setup overhead ([#14622](https://github.com/jestjs/jest/pull/14622))
- `[@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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ exports[`preset throws when module was found but no "jest-preset.js" or "jest-pr
exports[`preset throws when preset not found 1`] = `
"<red><bold><bold>● </intensity><bold>Validation Error</intensity>:</color>
<red></color>
<red> Preset <bold>doesnt-exist</intensity> not found.</color>
<red> Preset <bold>doesnt-exist</intensity> not found relative to rootDir <bold>/root/path/foo</intensity>.</color>
<red></color>
<red> <bold>Configuration Documentation:</intensity></color>
<red> https://jestjs.io/docs/configuration</color>
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/normalize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ const setupPreset = async (
);
}
throw createConfigError(
` Preset ${chalk.bold(presetPath)} not found.`,
` Preset ${chalk.bold(presetPath)} not found relative to rootDir ${chalk.bold(options.rootDir)}.`,
);
}
throw createConfigError(
Expand Down

0 comments on commit 9aa9060

Please sign in to comment.