diff --git a/CHANGELOG.md b/CHANGELOG.md index c2ca9095ab48..d1029ecdc72f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,6 @@ ## master -- `[jest-ci]` Add `moduleHiddenFiles` to allowed watch mode configs ([#6962](https://github.com/facebook/jest/pull/6962)) +- `[jest-ci]` Add `watchHiddenFiles` to allowed watch mode configs ([#6962](https://github.com/facebook/jest/pull/6962)) ## 23.6.0 diff --git a/TestUtils.js b/TestUtils.js index 8ef387ed6384..379d5956cb5b 100644 --- a/TestUtils.js +++ b/TestUtils.js @@ -85,7 +85,6 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = { }, moduleDirectories: [], moduleFileExtensions: ['js'], - moduleHiddenFiles: ['.gitignore'], moduleLoader: '/test_module_loader_path', moduleNameMapper: [], modulePathIgnorePatterns: [], @@ -116,6 +115,7 @@ const DEFAULT_PROJECT_CONFIG: ProjectConfig = { transform: [], transformIgnorePatterns: [], unmockedModulePathPatterns: null, + watchHiddenFiles: ['.gitignore'], watchPathIgnorePatterns: [], }; diff --git a/docs/Configuration.md b/docs/Configuration.md index 858fded3f7b6..49c475d652e5 100644 --- a/docs/Configuration.md +++ b/docs/Configuration.md @@ -343,12 +343,6 @@ An array of file extensions your modules use. If you require modules without spe If you are using TypeScript this should be `["js", "jsx", "json", "ts", "tsx"]`, check [ts-jest's documentation](https://github.com/kulshekhar/ts-jest). -### `moduleHiddenFiles` [array] - -Default: `[".gitignore"]` - -An array of hidden files your modules use. Jest detects also any changes in the specified hidden files - ### `moduleNameMapper` [object] Default: `null` @@ -934,6 +928,12 @@ Default: `false` Indicates whether each individual test should be reported during the run. All errors will also still be shown on the bottom after execution. +### `watchHiddenFiles` [array] + +Default: `[".gitignore"]` + +An array of hidden files your modules use. Jest detects also any changes in the specified hidden files + ### `watchPathIgnorePatterns` [array] Default: `[]` diff --git a/e2e/__tests__/__snapshots__/show_config.test.js.snap b/e2e/__tests__/__snapshots__/show_config.test.js.snap index 4923d39ca653..4c988dead9b4 100644 --- a/e2e/__tests__/__snapshots__/show_config.test.js.snap +++ b/e2e/__tests__/__snapshots__/show_config.test.js.snap @@ -30,7 +30,7 @@ exports[`--showConfig outputs config info and exits 1`] = ` \\"jsx\\", \\"node\\" ], - \\"moduleHiddenFiles\\": [ + \\"watchHiddenFiles\\": [ \\".gitignore\\" ], \\"moduleNameMapper\\": {}, diff --git a/packages/jest-config/src/Defaults.js b/packages/jest-config/src/Defaults.js index b75236a57b7b..2ce9afec9c8f 100644 --- a/packages/jest-config/src/Defaults.js +++ b/packages/jest-config/src/Defaults.js @@ -43,7 +43,6 @@ export default ({ }, moduleDirectories: ['node_modules'], moduleFileExtensions: ['js', 'json', 'jsx', 'node'], - moduleHiddenFiles: ['.gitignore'], moduleNameMapper: {}, modulePathIgnorePatterns: [], noStackTrace: false, @@ -80,6 +79,7 @@ export default ({ useStderr: false, verbose: null, watch: false, + watchHiddenFiles: ['.gitignore'], watchPathIgnorePatterns: [], watchman: true, }: DefaultOptions); diff --git a/packages/jest-config/src/index.js b/packages/jest-config/src/index.js index da568f348a43..478b4757b0e4 100644 --- a/packages/jest-config/src/index.js +++ b/packages/jest-config/src/index.js @@ -168,7 +168,6 @@ const getConfigs = ( haste: options.haste, moduleDirectories: options.moduleDirectories, moduleFileExtensions: options.moduleFileExtensions, - moduleHiddenFiles: options.moduleHiddenFiles, moduleLoader: options.moduleLoader, moduleNameMapper: options.moduleNameMapper, modulePathIgnorePatterns: options.modulePathIgnorePatterns, @@ -199,6 +198,7 @@ const getConfigs = ( transform: options.transform, transformIgnorePatterns: options.transformIgnorePatterns, unmockedModulePathPatterns: options.unmockedModulePathPatterns, + watchHiddenFiles: options.watchHiddenFiles, watchPathIgnorePatterns: options.watchPathIgnorePatterns, }), }); diff --git a/packages/jest-runtime/src/index.js b/packages/jest-runtime/src/index.js index 6beb089c117f..193f8ea05225 100644 --- a/packages/jest-runtime/src/index.js +++ b/packages/jest-runtime/src/index.js @@ -232,7 +232,7 @@ class Runtime { console: options && options.console, extensions: [Snapshot.EXTENSION].concat(config.moduleFileExtensions), hasteImplModulePath: config.haste.hasteImplModulePath, - hiddenFiles: config.moduleHiddenFiles, + hiddenFiles: config.watchHiddenFiles, ignorePattern, maxWorkers: (options && options.maxWorkers) || 1, mocksPattern: escapePathForRegex(path.sep + '__mocks__' + path.sep), diff --git a/types/Config.js b/types/Config.js index 7c3b9d9f6b88..f6843ad51378 100644 --- a/types/Config.js +++ b/types/Config.js @@ -47,7 +47,6 @@ export type DefaultOptions = {| detectOpenHandles: boolean, moduleDirectories: Array, moduleFileExtensions: Array, - moduleHiddenFiles: Array, moduleNameMapper: {[key: string]: string}, modulePathIgnorePatterns: Array, noStackTrace: boolean, @@ -86,6 +85,7 @@ export type DefaultOptions = {| verbose: ?boolean, watch: boolean, watchman: boolean, + watchHiddenFiles: Array, |}; export type InitialOptions = { @@ -124,7 +124,6 @@ export type InitialOptions = { mapCoverage?: boolean, moduleDirectories?: Array, moduleFileExtensions?: Array, - moduleHiddenFiles?: Array, moduleLoader?: Path, moduleNameMapper?: {[key: string]: string}, modulePathIgnorePatterns?: Array, @@ -180,6 +179,7 @@ export type InitialOptions = { watch?: boolean, watchAll?: boolean, watchman?: boolean, + watchHiddenFiles?: Array, watchPlugins?: Array, }; @@ -258,7 +258,6 @@ export type ProjectConfig = {| haste: HasteConfig, moduleDirectories: Array, moduleFileExtensions: Array, - moduleHiddenFiles: Array, moduleLoader: Path, moduleNameMapper: Array<[string, string]>, modulePathIgnorePatterns: Array, @@ -288,6 +287,7 @@ export type ProjectConfig = {| timers: 'real' | 'fake', transform: Array<[string, Path]>, transformIgnorePatterns: Array, + watchHiddenFiles: Array, watchPathIgnorePatterns: Array, unmockedModulePathPatterns: ?Array, |};