Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(jest-config): allow reporters in project config #14768

Merged
merged 9 commits into from
Dec 25, 2023
Merged
Show file tree
Hide file tree
Changes from all 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 @@ -29,6 +29,7 @@
- `[jest-circus, jest-expect, jest-snapshot]` Pass `test.failing` tests when containing failing snapshot matchers ([#14313](https://github.com/jestjs/jest/pull/14313))
- `[jest-config]` Make sure to respect `runInBand` option ([#14578](https://github.com/facebook/jest/pull/14578))
- `[jest-config]` Support `testTimeout` in project config ([#14697](https://github.com/facebook/jest/pull/14697))
- `[jest-config]` Allow `reporters` in project config ([#14768](https://github.com/jestjs/jest/pull/14768))
- `[@jest/expect-utils]` Fix comparison of `DataView` ([#14408](https://github.com/jestjs/jest/pull/14408))
- `[@jest/expect-utils]` [**BREAKING**] exclude non-enumerable in object matching ([#14670](https://github.com/jestjs/jest/pull/14670))
- `[@jest/expect-utils]` Fix comparison of `URL` ([#14672](https://github.com/jestjs/jest/pull/14672))
Expand Down
5 changes: 5 additions & 0 deletions packages/jest-config/src/ValidConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ export const initialProjectOptions: Config.InitialProjectOptions = {
openHandlesTimeout: 1000,
preset: 'react-native',
prettierPath: '<rootDir>/node_modules/prettier',
reporters: [
'default',
'custom-reporter-1',
['custom-reporter-2', {configValue: true}],
],
resetMocks: false,
resetModules: false,
resolver: '<rootDir>/resolver.js',
Expand Down
1 change: 1 addition & 0 deletions packages/jest-config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@ const groupOptions = (
modulePaths: options.modulePaths,
openHandlesTimeout: options.openHandlesTimeout,
prettierPath: options.prettierPath,
reporters: options.reporters,
resetMocks: options.resetMocks,
resetModules: options.resetModules,
resolver: options.resolver,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ exports[`prints the config object 1`] = `
"modulePaths": [],
"openHandlesTimeout": 1000,
"prettierPath": "prettier",
"reporters": [
"default",
"custom-reporter-1",
[
"custom-reporter-2",
{
"configValue": true
}
]
],
"resetMocks": false,
"resetModules": false,
"restoreMocks": false,
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/jest-types/src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,7 @@ export type ProjectConfig = {
openHandlesTimeout: number;
preset?: string;
prettierPath: string;
reporters: Array<string | ReporterConfig>;
resetMocks: boolean;
resetModules: boolean;
resolver?: string;
Expand Down
5 changes: 5 additions & 0 deletions packages/test-utils/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = {
modulePaths: [],
openHandlesTimeout: 1000,
prettierPath: 'prettier',
reporters: [
'default',
'custom-reporter-1',
['custom-reporter-2', {configValue: true}],
],
resetMocks: false,
resetModules: false,
resolver: undefined,
Expand Down
Loading