Do you want to request a _feature_ or report a _bug_?
Bug
What is the current behavior?
There's a different behaviour in escaping the path separator on Windows when the pattern is specified via CLI parameter vs. when it's inserted via the pattern prompt (pressing "p")
If I run on the command prompt something like
yarn jest folder\file --watchAll
then Jest would fail with
No tests found
[...]
Pattern: folder\file - 0 matches
but then if press p and enter the exact same pattern folder\file, Jest would find the correct file(s) and run correctly.
I know that the correct CLI pattern should be folder\\file but seeing the same input give different outputs is confusing.
Run npx envinfo --preset jest in your project directory and paste the
results here
System:
OS: Windows 10
CPU: x64 Intel(R) Core(TM) i7-3635QM CPU @ 2.40GHz
Binaries:
Node: 8.9.4
Yarn: 1.5.1
npm: 5.6.0
npmPackages:
jest:
wanted: ^22.4.3
installed: 22.4.3
Hello! Would it be fine if I start working on this?
Would be great!
Hi, is this still relevant or being worked on? I could take it up.
@jarvinenio all you!
Since this issue is still open, can I take it up as my very first PR? Also, could anyone tell me how to keep the consistency of these two behaviors? My idea is to prompt the user to check \ should be \\ or /, when running on the command prompt yarn jest folder\file --watchAll on the Windows. Thanks!
The whole regex auto escaping thing that the pattern prompt does here seems like too much magic to me - sure, typing \\ is annoying, but Windows users can just use the normal / as well. But I guess all of this will be solved when we eventually start using globs for path-related things.
For now, maybe we should apply the same replacePathSepForRegex logic (I thinks that's what does the escaping) to the CLI argument?
@jeysal Thanks! Can I start working on this issue now?
Maybe first wait if @thymikee or @simenb have thoughts on what's best here?
It should definitely behave the same regardless if it's specified from cli or watch mode.
I'd prefer using forward slashes for everything, but it should always be consistent
EDIT: does that answer the question? If not, please ping me.
@SimenB Can I start to try to fix this issue using jeysal's fixing advice?
I'd prefer using forward slashes for everything, but it should always be consistent
Yeah maybe just remove the magic escaping from the pattern prompt? If paths require entering two backslashes everywhere (proper regex) most people will probably start using slashes regardless of OS.
In a similar vain though, when using yarn test .\path\to\test\file.js in Windows it doesn't match up, but if you do yarn test ./path/to/test/file.js it does. The problem though is that when you are typing it from powershell/cmd, and using tab to auto complete the path, it automatically converts it to be single back slash.