Skip to content

Commit

Permalink
forgot about other notifyMode configs
Browse files Browse the repository at this point in the history
  • Loading branch information
psilospore committed Dec 20, 2017
1 parent 23a4307 commit 409be3c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/jest-cli/src/cli/args.js
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ export const options = {
type: 'boolean',
},
notifyMode: {
default: undefined,
default: 'always',
description: 'Specifies when notifications will appear for test results.',
type: 'string',
},
Expand Down
16 changes: 8 additions & 8 deletions packages/jest-cli/src/reporters/notify_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@ export default class NotifyReporter extends BaseReporter {
const success =
result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0;

const notifyMode = this._globalConfig.notifyMode;

if (
success &&
(this._globalConfig === 'always' ||
this._globalConfig === 'success' ||
(this._globalConfig === 'change' &&
(!this._previousSuccess || this._firstRun)))
(notifyMode === 'always' ||
notifyMode === 'success' ||
(notifyMode === 'change' && (!this._previousSuccess || this._firstRun)))
) {
const title = util.format('%d%% Passed', 100);
const message = util.format(
Expand All @@ -58,10 +59,9 @@ export default class NotifyReporter extends BaseReporter {
this._firstRun = false;
} else if (
!success &&
(this._globalConfig === 'always' ||
this._globalConfig === 'failure' ||
(this._globalConfig === 'change' &&
(this._previousSuccess || this._firstRun)))
(notifyMode === 'always' ||
notifyMode === 'failure' ||
(notifyMode === 'change' && (this._previousSuccess || this._firstRun)))
) {
const failed = result.numFailedTests / result.numTotalTests;

Expand Down
1 change: 1 addition & 0 deletions packages/jest-config/src/valid_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export default ({
name: 'string',
noStackTrace: false,
notify: false,
notifyMode: 'always',
onlyChanged: false,
preset: 'react-native',
projects: ['project-a', 'project-b/'],
Expand Down
1 change: 1 addition & 0 deletions types/Argv.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export type Argv = {|
noSCM: boolean,
noStackTrace: boolean,
notify: boolean,
notifyMode: string,
onlyChanged: boolean,
outputFile: string,
preset: ?string,
Expand Down

0 comments on commit 409be3c

Please sign in to comment.