diff --git a/CHANGELOG.md b/CHANGELOG.md index d783094aacb2..9696b0bc75d3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - `[jest-snapshot]` Enable configurable snapshot paths ([#6143](https://github.com/facebook/jest/pull/6143)) - `[jest-haste-map]` [**BREAKING**] Remove support for `@providesModule` ([#6104](https://github.com/facebook/jest/pull/6104)) - `[pretty-format]` Support HTMLCollection and NodeList in DOMCollection plugin ([#7125](https://github.com/facebook/jest/pull/7125)) +- `[jest-runtime]` Pass the normalized configuration to script transformers ([#7148](https://github.com/facebook/jest/pull/7148)) ### Fixes diff --git a/packages/jest-runtime/src/__tests__/__snapshots__/script_transformer.test.js.snap b/packages/jest-runtime/src/__tests__/__snapshots__/script_transformer.test.js.snap index 57301d112b4e..68522bebc832 100644 --- a/packages/jest-runtime/src/__tests__/__snapshots__/script_transformer.test.js.snap +++ b/packages/jest-runtime/src/__tests__/__snapshots__/script_transformer.test.js.snap @@ -2,6 +2,21 @@ exports[`ScriptTransformer passes expected transform options to getCacheKey 1`] = ` Object { + "config": Object { + "cache": true, + "cacheDirectory": "/cache/", + "name": "test", + "rootDir": "/", + "transform": Array [ + Array [ + "^.+\\\\.js$", + "test_preprocessor", + ], + ], + "transformIgnorePatterns": Array [ + "/node_modules/", + ], + }, "instrument": true, "rootDir": "/", } diff --git a/packages/jest-runtime/src/script_transformer.js b/packages/jest-runtime/src/script_transformer.js index a1debe6bed15..046a8d30ca5c 100644 --- a/packages/jest-runtime/src/script_transformer.js +++ b/packages/jest-runtime/src/script_transformer.js @@ -72,6 +72,7 @@ export default class ScriptTransformer { .createHash('md5') .update( transformer.getCacheKey(fileData, filename, configString, { + config: this._config, instrument, rootDir: this._config.rootDir, }), diff --git a/types/Transform.js b/types/Transform.js index b769fa8a4c17..e0345e5c85ff 100644 --- a/types/Transform.js +++ b/types/Transform.js @@ -26,6 +26,7 @@ export type TransformOptions = {| |}; export type CacheKeyOptions = {| + config: ProjectConfig, instrument: boolean, rootDir: string, |};