Skip to content

Commit 1480d84

Browse files
authored
Pass the normalized configuration to script transformers (jestjs#7148)
1 parent 367e182 commit 1480d84

File tree

4 files changed

+18
-0
lines changed

4 files changed

+18
-0
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- `[jest-snapshot]` Enable configurable snapshot paths ([#6143](https://github.com/facebook/jest/pull/6143))
1212
- `[jest-haste-map]` [**BREAKING**] Remove support for `@providesModule` ([#6104](https://github.com/facebook/jest/pull/6104))
1313
- `[pretty-format]` Support HTMLCollection and NodeList in DOMCollection plugin ([#7125](https://github.com/facebook/jest/pull/7125))
14+
- `[jest-runtime]` Pass the normalized configuration to script transformers ([#7148](https://github.com/facebook/jest/pull/7148))
1415

1516
### Fixes
1617

packages/jest-runtime/src/__tests__/__snapshots__/script_transformer.test.js.snap

+15
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,21 @@
22

33
exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] = `
44
Object {
5+
"config": Object {
6+
"cache": true,
7+
"cacheDirectory": "/cache/",
8+
"name": "test",
9+
"rootDir": "/",
10+
"transform": Array [
11+
Array [
12+
"^.+\\\\.js$",
13+
"test_preprocessor",
14+
],
15+
],
16+
"transformIgnorePatterns": Array [
17+
"/node_modules/",
18+
],
19+
},
520
"instrument": true,
621
"rootDir": "/",
722
}

packages/jest-runtime/src/script_transformer.js

+1
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export default class ScriptTransformer {
7272
.createHash('md5')
7373
.update(
7474
transformer.getCacheKey(fileData, filename, configString, {
75+
config: this._config,
7576
instrument,
7677
rootDir: this._config.rootDir,
7778
}),

types/Transform.js

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ export type TransformOptions = {|
2626
|};
2727

2828
export type CacheKeyOptions = {|
29+
config: ProjectConfig,
2930
instrument: boolean,
3031
rootDir: string,
3132
|};

0 commit comments

Comments
 (0)