forked from jestjs/jest
-
Notifications
You must be signed in to change notification settings - Fork 0
/
includes_dotfiles.test.ts
48 lines (40 loc) · 1.17 KB
/
includes_dotfiles.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/**
* Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import path from 'path';
import HasteMap from '../index';
const rootDir = path.join(__dirname, './test_dotfiles_root');
const commonOptions = {
extensions: ['js'],
maxWorkers: 1,
platforms: [],
resetCache: true,
retainAllFiles: true,
rootDir,
roots: [rootDir],
};
test('watchman crawler and node crawler both include dotfiles', async () => {
const hasteMapWithWatchman = new HasteMap({
...commonOptions,
name: 'withWatchman',
useWatchman: true,
});
const hasteMapWithNode = new HasteMap({
...commonOptions,
name: 'withNode',
useWatchman: false,
});
const [builtHasteMapWithWatchman, builtHasteMapWithNode] = await Promise.all([
hasteMapWithWatchman.build(),
hasteMapWithNode.build(),
]);
expect(
builtHasteMapWithWatchman.hasteFS.matchFiles('.eslintrc.js'),
).toHaveLength(1);
expect(builtHasteMapWithWatchman.hasteFS.getAllFiles().sort()).toEqual(
builtHasteMapWithNode.hasteFS.getAllFiles().sort(),
);
});