Skip to content

Commit 409be3c

Browse files
committed
forgot about other notifyMode configs
1 parent 23a4307 commit 409be3c

File tree

4 files changed

+11
-9
lines changed

4 files changed

+11
-9
lines changed

packages/jest-cli/src/cli/args.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ export const options = {
349349
type: 'boolean',
350350
},
351351
notifyMode: {
352-
default: undefined,
352+
default: 'always',
353353
description: 'Specifies when notifications will appear for test results.',
354354
type: 'string',
355355
},

packages/jest-cli/src/reporters/notify_reporter.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,13 @@ export default class NotifyReporter extends BaseReporter {
4040
const success =
4141
result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0;
4242

43+
const notifyMode = this._globalConfig.notifyMode;
44+
4345
if (
4446
success &&
45-
(this._globalConfig === 'always' ||
46-
this._globalConfig === 'success' ||
47-
(this._globalConfig === 'change' &&
48-
(!this._previousSuccess || this._firstRun)))
47+
(notifyMode === 'always' ||
48+
notifyMode === 'success' ||
49+
(notifyMode === 'change' && (!this._previousSuccess || this._firstRun)))
4950
) {
5051
const title = util.format('%d%% Passed', 100);
5152
const message = util.format(
@@ -58,10 +59,9 @@ export default class NotifyReporter extends BaseReporter {
5859
this._firstRun = false;
5960
} else if (
6061
!success &&
61-
(this._globalConfig === 'always' ||
62-
this._globalConfig === 'failure' ||
63-
(this._globalConfig === 'change' &&
64-
(this._previousSuccess || this._firstRun)))
62+
(notifyMode === 'always' ||
63+
notifyMode === 'failure' ||
64+
(notifyMode === 'change' && (this._previousSuccess || this._firstRun)))
6565
) {
6666
const failed = result.numFailedTests / result.numTotalTests;
6767

packages/jest-config/src/valid_config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export default ({
5858
name: 'string',
5959
noStackTrace: false,
6060
notify: false,
61+
notifyMode: 'always',
6162
onlyChanged: false,
6263
preset: 'react-native',
6364
projects: ['project-a', 'project-b/'],

types/Argv.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ export type Argv = {|
5353
noSCM: boolean,
5454
noStackTrace: boolean,
5555
notify: boolean,
56+
notifyMode: string,
5657
onlyChanged: boolean,
5758
outputFile: string,
5859
preset: ?string,

0 commit comments

Comments
 (0)