Skip to content

Commit

Permalink
Completes nodeCrawl with empty roots (jestjs#3776)
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj authored and cpojer committed Jun 9, 2017
1 parent c076947 commit d2d7a23
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
17 changes: 17 additions & 0 deletions packages/jest-haste-map/src/crawlers/__tests__/node-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,4 +198,21 @@ describe('node crawler', () => {
});
});
});

it('completes with emtpy roots', () => {
process.platform = 'win32';

nodeCrawl = require('../node');

const files = Object.create(null);
return nodeCrawl({
data: {files},
extensions: ['js'],
forceNodeFilesystemAPI: true,
ignore: pearMatcher,
roots: [],
}).then(data => {
expect(data.files).toEqual({});
});
});
});
6 changes: 5 additions & 1 deletion packages/jest-haste-map/src/crawlers/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,11 @@ function find(
});
}

roots.forEach(search);
if (roots.length > 0) {
roots.forEach(search);
} else {
callback(result);
}
}

function findNative(
Expand Down

0 comments on commit d2d7a23

Please sign in to comment.