Skip to content

Commit

Permalink
feat(jest-cli): add forceExitAfterTestRun avg
Browse files Browse the repository at this point in the history
After run all tests that force exit when forceExitAfterTestRun is true

jestjs#1456
  • Loading branch information
yutin1987 committed Oct 3, 2016
1 parent e4a50a4 commit aabcb89
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 6 additions & 0 deletions packages/jest-cli/src/cli/args.js
Expand Up @@ -261,6 +261,12 @@ const options = {
'Will run all tests affected by file changes in the last commit made.',
type: 'boolean',
},
forceExitAfterTestRun: {
default: false,
description:
'After run all tests that force exit.',
type: 'boolean',
},
};

module.exports = {
Expand Down
5 changes: 4 additions & 1 deletion packages/jest-cli/src/cli/index.js
Expand Up @@ -39,7 +39,10 @@ function run(argv?: Object, root?: Path) {
}

getJest(root).runCLI(argv, root, result => {
process.on('exit', () => process.exit(!result || result.success ? 0 : 1));
const success = !result || result.success;
process.on('exit', () => process.exit(success ? 0 : 1));

if (argv.forceExitAfterTestRun === true) process.exit(success ? 0 : 1);
});
}

Expand Down

0 comments on commit aabcb89

Please sign in to comment.