Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass the normalized configuration to script transformers #7148

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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": "/",
}
Expand Down
1 change: 1 addition & 0 deletions packages/jest-runtime/src/script_transformer.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default class ScriptTransformer {
.createHash('md5')
.update(
transformer.getCacheKey(fileData, filename, configString, {
config: this._config,
instrument,
rootDir: this._config.rootDir,
}),
Expand Down
1 change: 1 addition & 0 deletions types/Transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export type TransformOptions = {|
|};

export type CacheKeyOptions = {|
config: ProjectConfig,
instrument: boolean,
rootDir: string,
|};
Expand Down