feat(builders): add bail and silent options to jest

This commit is contained in:
Thomas Skalnik 2018-09-13 13:59:14 +02:00 committed by Jason Jean
parent f960d5aba2
commit 817691d38d
3 changed files with 20 additions and 2 deletions

View File

@ -67,7 +67,9 @@ describe('Jest Builder', () => {
ci: true, ci: true,
updateSnapshot: true, updateSnapshot: true,
onlyChanged: true, onlyChanged: true,
passWithNoTests: true passWithNoTests: true,
bail: true,
silent: true
} }
}) })
.toPromise(); .toPromise();
@ -84,7 +86,9 @@ describe('Jest Builder', () => {
ci: true, ci: true,
updateSnapshot: true, updateSnapshot: true,
onlyChanged: true, onlyChanged: true,
passWithNoTests: true passWithNoTests: true,
bail: true,
silent: true
}, },
['./jest.config.js'] ['./jest.config.js']
); );

View File

@ -15,11 +15,13 @@ export interface JestBuilderOptions {
jestConfig: string; jestConfig: string;
tsConfig: string; tsConfig: string;
watch: boolean; watch: boolean;
bail?: boolean;
ci?: boolean; ci?: boolean;
codeCoverage?: boolean; codeCoverage?: boolean;
onlyChanged?: boolean; onlyChanged?: boolean;
passWithNoTests?: boolean; passWithNoTests?: boolean;
setupFile?: string; setupFile?: string;
silent?: boolean;
updateSnapshot?: boolean; updateSnapshot?: boolean;
} }
@ -31,10 +33,12 @@ export default class JestBuilder implements Builder<JestBuilderOptions> {
const config: any = { const config: any = {
watch: options.watch, watch: options.watch,
coverage: options.codeCoverage, coverage: options.codeCoverage,
bail: options.bail,
ci: options.ci, ci: options.ci,
updateSnapshot: options.updateSnapshot, updateSnapshot: options.updateSnapshot,
onlyChanged: options.onlyChanged, onlyChanged: options.onlyChanged,
passWithNoTests: options.passWithNoTests, passWithNoTests: options.passWithNoTests,
silent: options.silent,
globals: JSON.stringify({ globals: JSON.stringify({
'ts-jest': { 'ts-jest': {
tsConfigFile: path.relative(builderConfig.root, options.tsConfig) tsConfigFile: path.relative(builderConfig.root, options.tsConfig)

View File

@ -49,6 +49,16 @@
"type": "boolean", "type": "boolean",
"description": "description":
"Fail on missing snapshots. (https://jestjs.io/docs/en/cli#ci)" "Fail on missing snapshots. (https://jestjs.io/docs/en/cli#ci)"
},
"bail": {
"type": "boolean",
"description":
"Exit the test suite immediately upon the first failing test suite. (https://jestjs.io/docs/en/cli#bail)"
},
"silent": {
"type": "boolean",
"description":
"Prevent tests from printing messages through the console. (https://jestjs.io/docs/en/cli#silent)"
} }
}, },
"required": ["jestConfig", "tsConfig"] "required": ["jestConfig", "tsConfig"]