Skip to content

Commit

Permalink
fix(jest-config): allow reporters in project config (#14768)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-snee-openx authored Dec 25, 2023
1 parent e20a4be commit 04204e4
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 8 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,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

0 comments on commit 04204e4

Please sign in to comment.