Skip to content

Commit 7caaa64

Browse files
committed
feat: Allow testRunner to be configurable
1 parent 522ed17 commit 7caaa64

15 files changed

Lines changed: 119 additions & 7 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
- `[jest-config]` [**BREAKING**] Set default display name color based on runner ([#8689](https://github.com/facebook/jest/pull/8689))
77
- `[jest-diff]` Add options for colors and symbols ([#8841](https://github.com/facebook/jest/pull/8841))
88
- `[@jest/test-result]` Create method to create empty `TestResult` ([#8867](https://github.com/facebook/jest/pull/8867))
9+
- `[jest-runner]` [**BREAKING**] Run transforms over `testRunnner` ([#8823](https://github.com/facebook/jest/pull/8823))
910

1011
### Fixes
1112

e2e/__tests__/transform.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -185,3 +185,14 @@ describe('transformer-config', () => {
185185
expect(stdout).toMatchSnapshot();
186186
});
187187
});
188+
189+
describe('transform-testrunner', () => {
190+
const dir = path.resolve(__dirname, '../transform/transform-testrunner');
191+
192+
it('should transform testRunner', () => {
193+
const {json, stderr} = runWithJson(dir, ['--no-cache']);
194+
expect(stderr).toMatch(/PASS/);
195+
expect(json.success).toBe(true);
196+
expect(json.numPassedTests).toBe(1);
197+
});
198+
});

e2e/babel-plugin-jest-hoist/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@
77
},
88
"jest": {
99
"automock": true,
10-
"testEnvironment": "node"
10+
"testEnvironment": "node",
11+
"transformIgnorePatterns": [
12+
"jest-jasmine2",
13+
"jest-circus"
14+
]
1115
}
1216
}

e2e/coverage-transform-instrumented/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44
"transform": {
55
"^.+\\.(js)$": "<rootDir>/preprocessor.js"
66
},
7+
"transformIgnorePatterns": [
8+
"jest-jasmine2",
9+
"jest-each",
10+
"jest-circus"
11+
],
712
"testRegex": "/__tests__/.*\\.(js)$",
813
"testEnvironment": "node",
914
"moduleFileExtensions": [

e2e/transform-linked-modules/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
"transformIgnorePatterns": [
55
"/node_modules/",
66
"<rootDir>/__tests__",
7-
"<rootDir>/ignored/"
7+
"<rootDir>/ignored/",
8+
"jest-jasmine2",
9+
"jest-each",
10+
"jest-circus"
811
],
912
"transform": {
1013
"^.+\\.js$": "<rootDir>/preprocessor.js"

e2e/transform/babel-jest-ignored/babel.config.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,6 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
module.exports = {only: ['blablabla']};
8+
module.exports = {
9+
only: ['blablabla', /jest-jasmine2/, /jest-circus/, /jest-each/],
10+
};

e2e/transform/multiple-transformers/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
"^.+\\.js$": "<rootDir>/jsPreprocessor.js",
66
"^.+\\.svg$": "<rootDir>/filePreprocessor.js"
77
},
8+
"transformIgnorePatterns": ["jest-jasmine2", "jest-circus"],
89
"testEnvironment": "node"
910
},
1011
"dependencies": {
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
it('should add two numbers', () => {
9+
expect(1 + 1).toBe(2);
10+
});
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
/**
2+
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
3+
*
4+
* This source code is licensed under the MIT license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
module.exports = {
9+
presets: [
10+
['@babel/preset-typescript'],
11+
[
12+
'@babel/preset-env',
13+
{
14+
targets: {node: 6},
15+
},
16+
],
17+
],
18+
};
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"jest": {
3+
"rootDir": "./",
4+
"testRunner": "<rootDir>/test-runner.ts"
5+
},
6+
"dependencies": {
7+
"@babel/preset-env": "^7.0.0",
8+
"@babel/preset-typescript": "^7.0.0"
9+
}
10+
}

0 commit comments

Comments
 (0)