Skip to content

Commit

Permalink
[haste-map]: Ignore Sapling vcs directories
Browse files Browse the repository at this point in the history
Summary: Ignore `.sl` directories in HasteMap.  This will allow Sapling to be
used with jest projects

Test Plan: `packages/jest-haste-map/src/__tests__/index.test.js` similar
testing plan to what's in #13673

Closes #13673
  • Loading branch information
vegerot committed Dec 14, 2022
1 parent 41bf230 commit 98ee4ff
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/jest-haste-map/src/__tests__/index.test.js
Expand Up @@ -346,6 +346,14 @@ describe('HasteMap', () => {
expect(hasteFS.matchFiles('.git')).toEqual([]);
});

it('ignores sapling vcs directories without ignore pattern', async () => {
mockFs[path.join('/', 'project', 'fruits', '.sl', 'package.json')] = `
invalid}{
`;
const {hasteFS} = await (await HasteMap.create(defaultConfig)).build();
expect(hasteFS.matchFiles('.sl')).toEqual([]);
});

it('ignores vcs directories with ignore pattern regex', async () => {
const config = {...defaultConfig, ignorePattern: /Kiwi/};
mockFs[path.join('/', 'project', 'fruits', 'Kiwi.js')] = `
Expand Down
2 changes: 1 addition & 1 deletion packages/jest-haste-map/src/index.ts
Expand Up @@ -125,7 +125,7 @@ const CHANGE_INTERVAL = 30;
const MAX_WAIT_TIME = 240000;
const NODE_MODULES = `${path.sep}node_modules${path.sep}`;
const PACKAGE_JSON = `${path.sep}package.json`;
const VCS_DIRECTORIES = ['.git', '.hg']
const VCS_DIRECTORIES = ['.git', '.hg', '.sl']
.map(vcs => escapePathForRegex(path.sep + vcs + path.sep))
.join('|');

Expand Down

0 comments on commit 98ee4ff

Please sign in to comment.