Skip to content

Commit

Permalink
feat(testting): added --watchAll option
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexei Domratchev committed Mar 22, 2019
1 parent 6550cf5 commit 458ae09
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
6 changes: 4 additions & 2 deletions packages/builders/src/jest/jest.builder.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ describe('Jest Builder', () => {
testNamePattern: 'test',
updateSnapshot: true,
useStderr: true,
watch: false
watch: false,
watchAll: false
}
})
.toPromise();
Expand Down Expand Up @@ -148,7 +149,8 @@ describe('Jest Builder', () => {
testNamePattern: 'test',
updateSnapshot: true,
useStderr: true,
watch: false
watch: false,
watchAll: false
},
['/root/jest.config.js']
);
Expand Down
4 changes: 3 additions & 1 deletion packages/builders/src/jest/jest.builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export interface JestBuilderOptions {
testFile?: string;
setupFile?: string;
tsConfig: string;
bail?: boolean | number;
bail?: number | boolean;
ci?: boolean;
color?: boolean;
json?: boolean;
Expand All @@ -36,6 +36,7 @@ export interface JestBuilderOptions {
updateSnapshot?: boolean;
useStderr?: boolean;
watch?: boolean;
watchAll?: boolean;
}

export default class JestBuilder implements Builder<JestBuilderOptions> {
Expand Down Expand Up @@ -82,6 +83,7 @@ export default class JestBuilder implements Builder<JestBuilderOptions> {
updateSnapshot: options.updateSnapshot,
useStderr: options.useStderr,
watch: options.watch,
wathcAll: options.watchAll,
globals: JSON.stringify({
'ts-jest': tsJestConfig
})
Expand Down
24 changes: 14 additions & 10 deletions packages/builders/src/jest/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
"type": "object",
"properties": {
"codeCoverage": {
"description": "Indicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/en/cli.html#coverage)",
"description": "Indicates that test coverage information should be collected and reported in the output. (https://jestjs.io/docs/en/cli#coverage)",
"type": "boolean"
},
"jestConfig": {
"description": "The path of the Jest configuration. (https://jestjs.io/docs/en/configuration.html)",
"description": "The path of the Jest configuration. (https://jestjs.io/docs/en/configuration)",
"type": "string"
},
"testFile": {
Expand All @@ -20,29 +20,29 @@
"type": "string"
},
"setupFile": {
"description": "The name of a setup file used by Jest. (https://jestjs.io/docs/en/configuration.html#setuptestframeworkscriptfile-string)",
"description": "The name of a setup file used by Jest. (https://jestjs.io/docs/en/configuration#setupfilesafterenv-array)",
"type": "string"
},
"bail": {
"alias": "b",
"description": "Exit the test suite immediately after `n` number of failing tests. (https://jestjs.io/docs/en/cli#bail)",
"type": ["boolean", "number"]
"type": ["number", "boolean"]
},
"ci": {
"description": "Whether to run Jest in continuous integration (CI) mode. This option is on by default in most popular CI environments. It will prevent snapshots from being written unless explicitly requested. (https://jestjs.io/docs/en/cli#ci)",
"type": "boolean"
},
"color": {
"description": "Forces test results output color highlighting (even if stdout is not a TTY). Set to false if you would like to have no colors.",
"description": "Forces test results output color highlighting (even if stdout is not a TTY). Set to false if you would like to have no colors. (https://jestjs.io/docs/en/cli#colors)",
"type": "boolean"
},
"json": {
"description": "Prints the test results in JSON. This mode will send all other test output and user messages to stderr.",
"description": "Prints the test results in JSON. This mode will send all other test output and user messages to stderr. (https://jestjs.io/docs/en/cli#json)",
"type": "boolean"
},
"maxWorkers": {
"alias": "w",
"description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/en/cli.html#maxworkers-num)",
"description": "Specifies the maximum number of workers the worker-pool will spawn for running tests. This defaults to the number of the cores available on your machine. Useful for CI. (its usually best not to override this default) (https://jestjs.io/docs/en/cli#maxworkers-num)",
"type": "number"
},
"onlyChanged": {
Expand All @@ -51,7 +51,7 @@
"type": "boolean"
},
"outputFile": {
"description": "Write test results to a file when the --json option is also specified.",
"description": "Write test results to a file when the --json option is also specified. (https://jestjs.io/docs/en/cli#outputfile-filename)",
"type": "string"
},
"passWithNoTests": {
Expand All @@ -60,7 +60,7 @@
},
"runInBand": {
"alias": "i",
"description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/en/cli.html#runinband)",
"description": "Run all tests serially in the current process (rather than creating a worker pool of child processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. Useful for CI. (https://jestjs.io/docs/en/cli#runinband)",
"type": "boolean"
},
"silent": {
Expand All @@ -69,7 +69,7 @@
},
"testNamePattern": {
"alias": "t",
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/en/cli.html#testnamepattern-regex)",
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/en/cli#testnamepattern-regex)",
"type": "string"
},
"updateSnapshot": {
Expand All @@ -84,6 +84,10 @@
"watch": {
"description": "Watch files for changes and rerun tests related to changed files. If you want to re-run all tests when a file has changed, use the `--watchAll` option. (https://jestjs.io/docs/en/cli#watch)",
"type": "boolean"
},
"watchAll": {
"description": "Watch files for changes and rerun all tests when something changes. If you want to re-run only the tests that depend on the changed files, use the `--watch` option. (https://jestjs.io/docs/en/cli#watchall)",
"type": "boolean"
}
},
"required": ["jestConfig", "tsConfig"]
Expand Down

0 comments on commit 458ae09

Please sign in to comment.