From f23d23ad8eb86de6528f76f67bb79f708eeb97bf Mon Sep 17 00:00:00 2001 From: artiebits Date: Tue, 12 Dec 2017 08:09:16 +0100 Subject: [PATCH 1/2] Do not support --watch inside non-version-controlled environments --- packages/jest-cli/src/run_jest.js | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) 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; }; From d8abb30603b333d71d42ace5fc33ced7fd34bbda Mon Sep 17 00:00:00 2001 From: artiebits Date: Tue, 12 Dec 2017 13:04:40 +0100 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) 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))