Skip to content

Commit

Permalink
Pass the normalized configuration to script transformers (#7148)
Browse files Browse the repository at this point in the history
  • Loading branch information
rubennorte authored Oct 12, 2018
1 parent 367e182 commit 1480d84
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 0 deletions.
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

0 comments on commit 1480d84

Please sign in to comment.