diff --git a/CHANGELOG.md b/CHANGELOG.md index c734361479c0..c44e8246533d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,8 @@ ### Fixes +* `[jest-cli]` Do not support `--watch` inside non-version-controlled environments + ([#5060](https://github.com/facebook/jest/pull/5060)) * `[jest-config]` Escape Windows path separator in testPathPattern CLI arguments ([#5054](https://github.com/facebook/jest/pull/5054) * `[jest-jasmine]` Register sourcemaps as node environment to improve performance with jsdom ([#5045](https://github.com/facebook/jest/pull/5045)) diff --git a/packages/jest-cli/src/run_jest.js b/packages/jest-cli/src/run_jest.js index a4a8a2a552d4..0776c82cf845 100644 --- a/packages/jest-cli/src/run_jest.js +++ b/packages/jest-cli/src/run_jest.js @@ -38,20 +38,16 @@ const getTestPaths = async ( changedFilesPromise, ) => { const source = new SearchSource(context); - let data = await source.getTestPaths(globalConfig, changedFilesPromise); + const data = await source.getTestPaths(globalConfig, changedFilesPromise); if (!data.tests.length && globalConfig.onlyChanged && data.noSCM) { - if (globalConfig.watch) { - data = await source.getTestPaths(globalConfig); - } else { - new Console(outputStream, outputStream).log( - 'Jest can only find uncommitted changed files in a git or hg ' + - 'repository. If you make your project a git or hg ' + - 'repository (`git init` or `hg init`), Jest will be able ' + - 'to only run tests related to files changed since the last ' + - 'commit.', - ); - } + new Console(outputStream, outputStream).log( + 'Jest can only find uncommitted changed files in a git or hg ' + + 'repository. If you make your project a git or hg ' + + 'repository (`git init` or `hg init`), Jest will be able ' + + 'to only run tests related to files changed since the last ' + + 'commit.', + ); } return data; };