Skip to content

Commit 0a0ac60

Browse files
authored
Support transforming testRunner with preset/transform (#8823)
1 parent 68d68f5 commit 0a0ac60

16 files changed

Lines changed: 123 additions & 10 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- `[jest-snapshot]`: [**BREAKING**] Make prettier optional for inline snapshots - fall back to string replacement ([#7792](https://github.com/facebook/jest/pull/7792))
88
- `[jest-repl, jest-runner]` [**BREAKING**] Run transforms over environment ([#8751](https://github.com/facebook/jest/pull/8751))
99
- `[jest-runner]` [**BREAKING**] Run transforms over `runnner` ([#8823](https://github.com/facebook/jest/pull/8823))
10+
- `[jest-runner]` [**BREAKING**] Run transforms over `testRunnner` ([#8823](https://github.com/facebook/jest/pull/8823))
1011

1112
### Fixes
1213

e2e/__tests__/transform.test.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,3 +227,14 @@ describe('transform-runner', () => {
227227
expect(json.numPassedTests).toBe(1);
228228
});
229229
});
230+
231+
describe('transform-testrunner', () => {
232+
const dir = path.resolve(__dirname, '../transform/transform-testrunner');
233+
234+
it('should transform testRunner', () => {
235+
const {json, stderr} = runWithJson(dir, ['--no-cache']);
236+
expect(stderr).toMatch(/PASS/);
237+
expect(json.success).toBe(true);
238+
expect(json.numPassedTests).toBe(1);
239+
});
240+
});

e2e/async-regenerator/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
"@babel/polyfill": "^7.2.5"
77
},
88
"jest": {
9-
"testEnvironment": "node"
9+
"testEnvironment": "node",
10+
"transformIgnorePatterns": [
11+
"jest-circus",
12+
"jest-jasmine2"
13+
]
1014
}
1115
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
"automock": true,
1010
"testEnvironment": "node",
1111
"transformIgnorePatterns": [
12-
"/jest-environment-node/"
12+
"jest-circus",
13+
"jest-environment-node",
14+
"jest-jasmine2"
1315
]
1416
}
1517
}

e2e/coverage-transform-instrumented/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,10 @@
77
"testRegex": "/__tests__/.*\\.(js)$",
88
"testEnvironment": "node",
99
"transformIgnorePatterns": [
10-
"/jest-environment-node/"
10+
"jest-circus",
11+
"jest-each",
12+
"jest-environment-node/",
13+
"jest-jasmine2"
1114
],
1215
"moduleFileExtensions": [
1316
"js"

e2e/transform-linked-modules/package.json

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

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

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

8-
module.exports = {only: ['blablabla', /jest-environment-node/]};
8+
module.exports = {
9+
only: [
10+
'blablabla',
11+
/jest-circus/,
12+
/jest-each/,
13+
/jest-environment-node/,
14+
/jest-jasmine2/,
15+
/jest-source-map/,
16+
],
17+
};

e2e/transform/multiple-transformers/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
},
88
"testEnvironment": "node",
99
"transformIgnorePatterns": [
10-
"/jest-environment-node/"
10+
"jest-circus",
11+
"jest-environment-node",
12+
"jest-jasmine2"
1113
]
1214
},
1315
"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: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
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-env', {targets: {node: 'current'}}],
11+
'@babel/preset-typescript',
12+
],
13+
};

0 commit comments

Comments
 (0)