-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(haste-map): watchman crawler now includes dotfiles (#10075)
- Loading branch information
Showing
11 changed files
with
132 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
packages/jest-haste-map/src/__tests__/includes_dotfiles.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,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(), | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/jest-haste-map/src/__tests__/test_dotfiles_root/.eslintrc.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* 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. | ||
*/ |
6 changes: 6 additions & 0 deletions
6
packages/jest-haste-map/src/__tests__/test_dotfiles_root/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
/** | ||
* 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. | ||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters