-
-
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
[Bug]: Jest forces path separators to forward slashes in testMatch #15516
Comments
|
@mrazauskas The explanation you gave isn't present on the page you linked, which I combed over several times before writing this post anyway. Considering the ignore pattern right below the test match in the console output uses OS-specific separators, it would be nice if there was mention of micromatch being separator agnostic to avoid the confusion I went through. And besides, there's still the issue that my pattern matches zero test files, so what gives? |
You can keep on complaining or try to understand how globs and this particular implementation works. All is provided in documentation link which has link to implementation documentation which has more links. Etc. |
I did read the docs my guy. I still don't understand why the glob I feed jest doesn't find my test file. I also don't think it's unreasonable to request that common pitfalls of the pattern matching library you use be documented on your end of things. Your motto about jest being "delightful" to use doesn't ring especially true right now. |
Anyway, I figured out why it wasn't matching my tests: you need to append __dirname to the front of your match if you want it to only search specific folders. This seems to be because jest only checks matches against absolute paths, and not paths relative to the current directory. Which, I'll add, is not a problem with micromatch or my lack of understanding of how it works. You can close this issue, I guess. Edit: Actually, your docs do mention this whole business with absolute paths, just not in the testMatch section, but in the transformIgnorePatterns section instead, which I found just now on a whim. I would request for testMatch to receive the same attention and have the absolute path explanation added there too for completeness. |
Version
29.7.0
Steps to reproduce
Using this
jest.config.ts
file, run jest to try and run all tests in atests
folder.Expected behavior
It finds my single test file.
Actual behavior
It does not find my single test file.
Additional context
I assume I'm doing something wrong because it seems inconceivable to me that converting backslashes to forward slashes on windows is the intended behavior, yet I can't fathom what it is I've misconfigured.
Environment
The text was updated successfully, but these errors were encountered: