Skip to content

Commit 04204e4

Browse files
fix(jest-config): allow reporters in project config (#14768)
1 parent e20a4be commit 04204e4

File tree

7 files changed

+61
-8
lines changed

7 files changed

+61
-8
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
- `[jest-circus, jest-expect, jest-snapshot]` Pass `test.failing` tests when containing failing snapshot matchers ([#14313](https://github.com/jestjs/jest/pull/14313))
3131
- `[jest-config]` Make sure to respect `runInBand` option ([#14578](https://github.com/facebook/jest/pull/14578))
3232
- `[jest-config]` Support `testTimeout` in project config ([#14697](https://github.com/facebook/jest/pull/14697))
33+
- `[jest-config]` Allow `reporters` in project config ([#14768](https://github.com/jestjs/jest/pull/14768))
3334
- `[@jest/expect-utils]` Fix comparison of `DataView` ([#14408](https://github.com/jestjs/jest/pull/14408))
3435
- `[@jest/expect-utils]` [**BREAKING**] exclude non-enumerable in object matching ([#14670](https://github.com/jestjs/jest/pull/14670))
3536
- `[@jest/expect-utils]` Fix comparison of `URL` ([#14672](https://github.com/jestjs/jest/pull/14672))

packages/jest-config/src/ValidConfig.ts

+5
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,11 @@ export const initialProjectOptions: Config.InitialProjectOptions = {
280280
openHandlesTimeout: 1000,
281281
preset: 'react-native',
282282
prettierPath: '<rootDir>/node_modules/prettier',
283+
reporters: [
284+
'default',
285+
'custom-reporter-1',
286+
['custom-reporter-2', {configValue: true}],
287+
],
283288
resetMocks: false,
284289
resetModules: false,
285290
resolver: '<rootDir>/resolver.js',

packages/jest-config/src/index.ts

+1
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ const groupOptions = (
178178
modulePaths: options.modulePaths,
179179
openHandlesTimeout: options.openHandlesTimeout,
180180
prettierPath: options.prettierPath,
181+
reporters: options.reporters,
181182
resetMocks: options.resetMocks,
182183
resetModules: options.resetModules,
183184
resolver: options.resolver,

packages/jest-core/src/lib/__tests__/__snapshots__/logDebugMessages.test.ts.snap

+10
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,16 @@ exports[`prints the config object 1`] = `
3535
"modulePaths": [],
3636
"openHandlesTimeout": 1000,
3737
"prettierPath": "prettier",
38+
"reporters": [
39+
"default",
40+
"custom-reporter-1",
41+
[
42+
"custom-reporter-2",
43+
{
44+
"configValue": true
45+
}
46+
]
47+
],
3848
"resetMocks": false,
3949
"resetModules": false,
4050
"restoreMocks": false,

packages/jest-transform/src/__tests__/__snapshots__/ScriptTransformer.test.ts.snap

+38-8
Large diffs are not rendered by default.

packages/jest-types/src/Config.ts

+1
Original file line numberDiff line numberDiff line change
@@ -466,6 +466,7 @@ export type ProjectConfig = {
466466
openHandlesTimeout: number;
467467
preset?: string;
468468
prettierPath: string;
469+
reporters: Array<string | ReporterConfig>;
469470
resetMocks: boolean;
470471
resetModules: boolean;
471472
resolver?: string;

packages/test-utils/src/config.ts

+5
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,11 @@ const DEFAULT_PROJECT_CONFIG: Config.ProjectConfig = {
9999
modulePaths: [],
100100
openHandlesTimeout: 1000,
101101
prettierPath: 'prettier',
102+
reporters: [
103+
'default',
104+
'custom-reporter-1',
105+
['custom-reporter-2', {configValue: true}],
106+
],
102107
resetMocks: false,
103108
resetModules: false,
104109
resolver: undefined,

0 commit comments

Comments
 (0)