-
-
Notifications
You must be signed in to change notification settings - Fork 6.6k
perf(changed-files): limit git and hg commands to specified roots #6732
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
thymikee
merged 5 commits into
jestjs:master
from
booleanbetrayal:perf-changed-files-roots
Jul 21, 2018
Merged
Changes from 2 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
33acece
perf(changed-files): limit git and hg commands to specified roots
booleanbetrayal aac709c
move roots into Options as optional property and always provide via g…
booleanbetrayal 8521eb4
remove redundant root
booleanbetrayal dcec626
drop the shoulds
booleanbetrayal 3647446
"monitors only" instead of "monitors" in test labels
booleanbetrayal File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -224,6 +224,27 @@ test('gets changed files for git', async () => { | |
| ).toEqual(['file5.txt']); | ||
| }); | ||
|
|
||
| test('should only monitor root paths for git', async () => { | ||
| writeFiles(DIR, { | ||
| 'file1.txt': 'file1', | ||
| 'nested_dir/file2.txt': 'file2', | ||
| 'nested_dir/second_nested_dir/file3.txt': 'file3', | ||
| }); | ||
|
|
||
| run(`${GIT} init`, DIR); | ||
|
|
||
| const roots = ['nested_dir', 'nested_dir/second_nested_dir'].map(filename => | ||
| path.resolve(DIR, filename), | ||
| ); | ||
|
|
||
| const {changedFiles: files} = await getChangedFilesForRoots(roots, {}); | ||
| expect( | ||
| Array.from(files) | ||
| .map(filePath => path.basename(filePath)) | ||
| .sort(), | ||
| ).toEqual(['file2.txt', 'file3.txt']); | ||
| }); | ||
|
|
||
| test('gets changed files for hg', async () => { | ||
| if (process.env.CI) { | ||
| // Circle and Travis have very old version of hg (v2, and current | ||
|
|
@@ -326,3 +347,31 @@ test('gets changed files for hg', async () => { | |
| .sort(), | ||
| ).toEqual(['file5.txt']); | ||
| }); | ||
|
|
||
| test('should only monitor root paths for hg', async () => { | ||
|
||
| if (process.env.CI) { | ||
| // Circle and Travis have very old version of hg (v2, and current | ||
| // version is v4.2) and its API changed since then and not compatible | ||
| // any more. Changing the SCM version on CIs is not trivial, so we'll just | ||
| // skip this test and run it only locally. | ||
| return; | ||
| } | ||
| writeFiles(DIR, { | ||
| 'file1.txt': 'file1', | ||
| 'nested_dir/file2.txt': 'file2', | ||
| 'nested_dir/second_nested_dir/file3.txt': 'file3', | ||
| }); | ||
|
|
||
| run(`${HG} init`, DIR); | ||
|
|
||
| const roots = ['nested_dir', 'nested_dir/second_nested_dir'].map(filename => | ||
| path.resolve(DIR, filename), | ||
| ); | ||
|
|
||
| const {changedFiles: files} = await getChangedFilesForRoots(roots, {}); | ||
| expect( | ||
| Array.from(files) | ||
| .map(filePath => path.basename(filePath)) | ||
| .sort(), | ||
| ).toEqual(['file2.txt', 'file3.txt']); | ||
| }); | ||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems like
nested_diralready includesnested_dir/second_nested_dirrootUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated / removed redundant root!