Skip to content

Commit

Permalink
feat(testing): adding jest option testPathPattern
Browse files Browse the repository at this point in the history
IntelliJ Idea passes this option to jest when running tests directly in the IDE.
  • Loading branch information
Sven Röttering authored and vsavkin committed Jul 7, 2019
1 parent 055e8bc commit dc556bd
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions docs/api-jest/builders/jest.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,12 @@ Type: `string`

Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/en/cli#testnamepattern-regex)

### testPathPattern

Type: `string`

A regexp pattern string that is matched against all tests paths before executing the test. (https://jestjs.io/docs/en/cli#testpathpattern-regex)

### tsConfig

Type: `string`
Expand Down
4 changes: 4 additions & 0 deletions packages/jest/src/builders/jest/jest.impl.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('Jest Builder', () => {
codeCoverage: false,
runInBand: true,
testNamePattern: 'should load',
testPathPattern: '/test/path',
colors: false,
reporters: '/test/path',
verbose: false,
Expand Down Expand Up @@ -102,6 +103,7 @@ describe('Jest Builder', () => {
coverage: false,
runInBand: true,
testNamePattern: 'should load',
testPathPattern: '/test/path',
colors: false,
reporters: '/test/path',
verbose: false,
Expand All @@ -128,6 +130,7 @@ describe('Jest Builder', () => {
passWithNoTests: true,
silent: true,
testNamePattern: 'test',
testPathPattern: '/test/path',
colors: false,
reporters: '/test/path',
verbose: false,
Expand Down Expand Up @@ -169,6 +172,7 @@ describe('Jest Builder', () => {
passWithNoTests: true,
silent: true,
testNamePattern: 'test',
testPathPattern: '/test/path',
colors: false,
verbose: false,
reporters: '/test/path',
Expand Down
2 changes: 2 additions & 0 deletions packages/jest/src/builders/jest/jest.impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export interface JestBuilderOptions extends JsonObject {
runInBand?: boolean;
silent?: boolean;
testNamePattern?: string;
testPathPattern?: string;
colors?: boolean;
reporters?: string;
verbose?: false;
Expand Down Expand Up @@ -86,6 +87,7 @@ function run(
runInBand: options.runInBand,
silent: options.silent,
testNamePattern: options.testNamePattern,
testPathPattern: options.testPathPattern,
colors: options.colors,
reporters: options.reporters,
verbose: options.verbose,
Expand Down
4 changes: 4 additions & 0 deletions packages/jest/src/builders/jest/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@
"description": "Run only tests with a name that matches the regex pattern. (https://jestjs.io/docs/en/cli#testnamepattern-regex)",
"type": "string"
},
"testPathPattern": {
"description": "A regexp pattern string that is matched against all tests paths before executing the test. (https://jestjs.io/docs/en/cli#testpathpattern-regex)",
"type": "string"
},
"colors": {
"description": "Forces test results output highlighting even if stdout is not a TTY. (https://jestjs.io/docs/en/cli#colors)",
"type": "boolean"
Expand Down

0 comments on commit dc556bd

Please sign in to comment.