From 2c18a53e8ff2437bba5fcb8076b754ac5f79f9f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Norte?= Date: Fri, 9 Nov 2018 01:15:56 +0000 Subject: [PATCH] Add computeSha1 option (#7345) --- CHANGELOG.md | 1 + e2e/__tests__/__snapshots__/show_config.test.js.snap | 1 + packages/jest-config/src/Defaults.js | 1 + packages/jest-config/src/ValidConfig.js | 1 + packages/jest-runtime/src/index.js | 1 + types/Config.js | 1 + 6 files changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1df683e1edfd..4e5e2d08c8fb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ - `[jest-util]` Add `jest.getTimerCount()` to get the count of scheduled fake timers ([#7285](https://github.com/facebook/jest/pull/7285)) - `[jest-config]` Add `dependencyExtractor` option to use a custom module to extract dependencies from files ([#7313](https://github.com/facebook/jest/pull/7313)) - `[jest-haste-map]` [**BREAKING**] Expose relative paths when getting the file iterator ([#7321](https://github.com/facebook/jest/pull/7321)) +- `[jest-config]` Add `haste.computeSha1` option to compute the sha-1 of the files in the haste map ([#7345](https://github.com/facebook/jest/pull/7345)) ### Fixes diff --git a/e2e/__tests__/__snapshots__/show_config.test.js.snap b/e2e/__tests__/__snapshots__/show_config.test.js.snap index cf77d55b5751..24f419707d6d 100644 --- a/e2e/__tests__/__snapshots__/show_config.test.js.snap +++ b/e2e/__tests__/__snapshots__/show_config.test.js.snap @@ -21,6 +21,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` \\"forceCoverageMatch\\": [], \\"globals\\": {}, \\"haste\\": { + \\"computeSha1\\": false, \\"providesModuleNodeModules\\": [] }, \\"moduleDirectories\\": [ diff --git a/packages/jest-config/src/Defaults.js b/packages/jest-config/src/Defaults.js index ea40b3cf4e05..85b29b28f577 100644 --- a/packages/jest-config/src/Defaults.js +++ b/packages/jest-config/src/Defaults.js @@ -41,6 +41,7 @@ export default ({ globalTeardown: null, globals: {}, haste: { + computeSha1: false, providesModuleNodeModules: [], }, moduleDirectories: ['node_modules'], diff --git a/packages/jest-config/src/ValidConfig.js b/packages/jest-config/src/ValidConfig.js index 2d2d4128bc48..c3da446f08a5 100644 --- a/packages/jest-config/src/ValidConfig.js +++ b/packages/jest-config/src/ValidConfig.js @@ -51,6 +51,7 @@ export default ({ globalTeardown: 'teardown.js', globals: {__DEV__: true}, haste: { + computeSha1: true, defaultPlatform: 'ios', hasteImplModulePath: '/haste_impl.js', platforms: ['ios', 'android'], diff --git a/packages/jest-runtime/src/index.js b/packages/jest-runtime/src/index.js index f60b33b0dae6..f91e481a2925 100644 --- a/packages/jest-runtime/src/index.js +++ b/packages/jest-runtime/src/index.js @@ -236,6 +236,7 @@ class Runtime { return new HasteMap({ cacheDirectory: config.cacheDirectory, + computeSha1: config.haste.computeSha1, console: options && options.console, dependencyExtractor: config.dependencyExtractor, extensions: [Snapshot.EXTENSION].concat(config.moduleFileExtensions), diff --git a/types/Config.js b/types/Config.js index 957cb3afeaab..39eac782b764 100644 --- a/types/Config.js +++ b/types/Config.js @@ -11,6 +11,7 @@ export type Path = string; export type Glob = string; export type HasteConfig = {| + computeSha1?: boolean, defaultPlatform?: ?string, hasteImplModulePath?: string, platforms?: Array,