Skip to content

Commit

Permalink
Do not support --watch inside non-version-controlled environments (#5060
Browse files Browse the repository at this point in the history
)

* Do not support --watch inside non-version-controlled environments

* Update CHANGELOG.md
  • Loading branch information
artiebits authored and cpojer committed Dec 12, 2017
1 parent cc215d1 commit 036eb60
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down
20 changes: 8 additions & 12 deletions packages/jest-cli/src/run_jest.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
};
Expand Down

0 comments on commit 036eb60

Please sign in to comment.