-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Windows watch mode fix #3563
Windows watch mode fix #3563
Conversation
This fixes the issue in my testing. Can we please get it in? |
Feel free to stamp it and @cpojer will merge soon. We could cut a patch release for that I think, but would need to double check for breaking changes |
Yes we can do a patch with this tomorrow. Seems like this diff has lint errors, though. Can you fix them up and make CI pass? |
Although I'm not super happy we use a third party until just for that, but didn't have time to check what it does, maybe it's reasonable. |
Yeah, it's only used in the test file – can we inline it rather than adding a dependency? Why can't we use |
packages/jest-cli/src/watch.js
Outdated
const isValidPath = require('./lib/isValidPath'); | ||
const preRunMessage = require('./preRunMessage'); | ||
const replacePathSepForRegex = require('jest-regex-util').replacePathSepForRegex; |
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.
nit: const {replacePathSepForRegex} = require('jest-regex-util');
Hey, just caught up on this. You can see my last two comments at #3516 which explains the idea behind
so it would be super easy to inline. I'm not a master at regex, so I'm not sure if there's a more optimal / better regex pattern? As for using The test uses a snapshot of a Unix style path pattern. So on windows, for the test to pass, we need a function of the form
to match the snapshot so the test passes on Windows. I'll push the code review fix in a moment. I'm happy to add that helper function to |
packages/jest-cli/src/watch.js
Outdated
const isValidPath = require('./lib/isValidPath'); | ||
const preRunMessage = require('./preRunMessage'); | ||
const { replacePathSepForRegex } = require('jest-regex-util'); |
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.
nit: remove the spaces.
Can we just inline this in the test? The function is not needed outside the test itself. Proposal:
|
@scottrangerio If you don't mind I'll fix up the nits and push to your branch. |
@gaearon Ah sorry, I only just saw this comment! I just pushed some code but feel free to take over from here on out! Cheers |
packages/jest-cli/yarn.lock
Outdated
@@ -2,6 +2,27 @@ | |||
# yarn lockfile v1 | |||
|
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.
You can probably revert this file?
@@ -145,6 +145,8 @@ describe('Watch mode flows', () => { | |||
}); | |||
|
|||
it('can select a specific file name from the typeahead results', () => { | |||
const toUnixPathPattern = pathPattern => pathPattern.replace(/\\\\/g, '/'); |
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.
Can you explain why we need to replace two backslashes with a single slash? Where does the second backslash come from?
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.
I guess because we're dealing with a pattern, so it needs an escape.
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 this is ready. I would really appreciate a patch for this. |
Codecov Report
@@ Coverage Diff @@
## master #3563 +/- ##
=========================================
+ Coverage 62.39% 62.4% +<.01%
=========================================
Files 181 181
Lines 6646 6647 +1
Branches 6 6
=========================================
+ Hits 4147 4148 +1
Misses 2496 2496
Partials 3 3
Continue to review full report at Codecov.
|
* Fix interactive watch arrow selection on Windows jestjs#3516 * Refactored fix for jestjs#3516 to use replacePathSepForRegex * Fixed the failing test on Windows for the jestjs#3516 fix * Bump regex-slash to 1.0.1 (provides a flow lib def) * Update watch-filename-pattern-mode-test.js * Code review feedback * Fixed lint errors and implemented PR feedback * Revert yarn.lock changes
* Fix interactive watch arrow selection on Windows jestjs#3516 * Refactored fix for jestjs#3516 to use replacePathSepForRegex * Fixed the failing test on Windows for the jestjs#3516 fix * Bump regex-slash to 1.0.1 (provides a flow lib def) * Update watch-filename-pattern-mode-test.js * Code review feedback * Fixed lint errors and implemented PR feedback * Revert yarn.lock changes
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
Fixes #3516
Test plan
Run the
'can select a specific file name from the typeahead results'
test inwatch-filename-pattern-mode-test.js
on both Windows and Unix based systems