Skip to content

Commit

Permalink
Use watchAll fallback for non git/hq projects (jestjs#4419)
Browse files Browse the repository at this point in the history
  • Loading branch information
sesigl committed Oct 21, 2017
1 parent 0748e6f commit 58d6fab
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions packages/jest-cli/src/cli/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {print as preRunMessagePrint} from '../pre_run_message';
import runJest from '../run_jest';
import Runtime from 'jest-runtime';
import TestWatcher from '../test_watcher';
import updateGlobalConfig from '../lib/update_global_config';
import watch from '../watch';
import yargs from 'yargs';
import rimraf from 'rimraf';
Expand Down Expand Up @@ -297,6 +298,18 @@ const _run = async (
// Queries to hg/git can take a while, so we need to start the process
// as soon as possible, so by the time we need the result it's already there.
const changedFilesPromise = getChangedFilesPromise(globalConfig, configs);

if (globalConfig.watch && !changedFilesPromise) {
console.log(
'The project folder is no git and no mercurial project. ' +
chalk.bold('Watching all files') +
' instead...',
);
globalConfig = updateGlobalConfig(globalConfig, {
mode: 'watchAll',
});
}

const {contexts, hasteMapInstances} = await buildContextsAndHasteMaps(
configs,
globalConfig,
Expand Down

0 comments on commit 58d6fab

Please sign in to comment.