Skip to content

Commit

Permalink
Remove file watching support from Jest.
Browse files Browse the repository at this point in the history
Summary:Fixes #714, probably also #722 and also facebook/react-native#6019
Closes #724

Differential Revision: D2953708

fb-gh-sync-id: 110a30d6c11256644c8e4f7ab1d7b7cb5fa1b021
shipit-source-id: 110a30d6c11256644c8e4f7ab1d7b7cb5fa1b021
  • Loading branch information
cpojer authored and facebook-github-bot-2 committed Feb 19, 2016
1 parent 7b7a9d7 commit aa6fed8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "jest-cli",
"description": "Painless JavaScript Unit Testing.",
"version": "0.9.0-fb1",
"version": "0.9.0-fb2",
"main": "src/jest.js",
"dependencies": {
"chalk": "^1.1.1",
Expand All @@ -14,7 +14,7 @@
"json-stable-stringify": "^1.0.0",
"lodash.template": "^3.6.2",
"mkdirp": "^0.5.1",
"node-haste": "^2.1.2",
"node-haste": "^2.2.0",
"optimist": "^0.6.1",
"resolve": "^1.1.6",
"sane": "^1.2.0",
Expand Down
15 changes: 9 additions & 6 deletions src/resolvers/HasteResolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ const path = require('path');

const REQUIRE_EXTENSIONS_PATTERN = /(\b(?:require\s*?\.\s*?(?:requireActual|requireMock)|jest\s*?\.\s*?genMockFromModule)\s*?\(\s*?)(['"])([^'"]+)(\2\s*?\))/g;

const createWatcher = config => {
if (config.watchman && FileWatcher.canUseWatchman()) {
return new FileWatcher(config.testPathDirs.map(dir => ({dir})));
}

return FileWatcher.createDummyWatcher();
};

class HasteResolver {

constructor(config, options) {
Expand All @@ -39,12 +47,7 @@ class HasteResolver {
cacheKey: getCacheKey('jest-haste-map', config),
});

this._fileWatcher = new FileWatcher(
config.testPathDirs.map(dir => ({dir})),
{
useWatchman: config.watchman,
}
);
this._fileWatcher = createWatcher(config);

this._mappedModuleNames = Object.create(null);
if (config.moduleNameMapper.length) {
Expand Down

0 comments on commit aa6fed8

Please sign in to comment.