Skip to content

Commit

Permalink
updated linting and jest test
Browse files Browse the repository at this point in the history
  • Loading branch information
psilospore committed Dec 19, 2017
1 parent dbb1363 commit 5379f7f
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ exports[`--showConfig outputs config info and exits 1`] = `
\\"maxWorkers\\": \\"[maxWorkers]\\",
\\"noStackTrace\\": false,
\\"nonFlagArgs\\": [],
\\"notify\\": false,
\\"notify\\": \\"false\\",
\\"passWithNoTests\\": false,
\\"rootDir\\": \\"<<REPLACED_ROOT_DIR>>\\",
\\"runTestsByPath\\": false,
Expand Down
11 changes: 9 additions & 2 deletions packages/jest-cli/src/reporters/notify_reporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,22 @@ export default class NotifyReporter extends BaseReporter {
const success =
result.numFailedTests === 0 && result.numRuntimeErrorTestSuites === 0;

if (success && (this._globalConfig.notify === "true" || this._globalConfig.notify === "onSuccess")) {
if (
success &&
(this._globalConfig.notify === 'true' ||
this._globalConfig.notify === 'onSuccess')
) {
const title = util.format('%d%% Passed', 100);
const message = util.format(
(isDarwin ? '\u2705 ' : '') + '%d tests passed',
result.numPassedTests,
);

notifier.notify({icon, message, title});
} else if (this._globalConfig.notify === "true" || this._globalConfig.notify === "onFailure") {
} else if (
this._globalConfig.notify === 'true' ||
this._globalConfig.notify === 'onFailure'
) {
const failed = result.numFailedTests / result.numTotalTests;

const title = util.format(
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-cli/src/test_scheduler.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ export default class TestScheduler {
this.addReporter(new CoverageReporter(this._globalConfig));
}

if (notify !== "false") {
if (notify !== 'false') {
this.addReporter(
new NotifyReporter(this._globalConfig, this._options.startRun),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/defaults.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export default ({
moduleNameMapper: {},
modulePathIgnorePatterns: [],
noStackTrace: false,
notify: "false",
notify: 'false',
preset: null,
resetMocks: false,
resetModules: false,
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-config/src/valid_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default ({
modulePaths: ['/shared/vendor/modules'],
name: 'string',
noStackTrace: false,
notify: "false",
notify: 'false',
onlyChanged: false,
preset: 'react-native',
projects: ['project-a', 'project-b/'],
Expand Down
4 changes: 2 additions & 2 deletions packages/jest-validate/src/__tests__/fixtures/jest_config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const defaultConfig = {
moduleNameMapper: {},
modulePathIgnorePatterns: [],
noStackTrace: false,
notify: "false",
notify: 'false',
preset: null,
resetMocks: false,
resetModules: false,
Expand Down Expand Up @@ -94,7 +94,7 @@ const validConfig = {
modulePaths: ['/shared/vendor/modules'],
name: 'string',
noStackTrace: false,
notify: "false",
notify: 'false',
preset: 'react-native',
resetMocks: false,
resetModules: false,
Expand Down
2 changes: 1 addition & 1 deletion test_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const DEFAULT_GLOBAL_CONFIG: GlobalConfig = {
noSCM: null,
noStackTrace: false,
nonFlagArgs: [],
notify: "false",
notify: 'false',
onlyChanged: false,
onlyFailures: false,
outputFile: null,
Expand Down

0 comments on commit 5379f7f

Please sign in to comment.