-
-
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
Replace path sep for testRegex in should_instrument #5560
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ import type {Path, ProjectConfig} from 'types/Config'; | |
import type {Options} from './script_transformer'; | ||
|
||
import path from 'path'; | ||
import {escapePathForRegex} from 'jest-regex-util'; | ||
import {escapePathForRegex, replacePathSepForRegex} from 'jest-regex-util'; | ||
import micromatch from 'micromatch'; | ||
|
||
const MOCKS_PATTERN = new RegExp( | ||
|
@@ -35,7 +35,10 @@ export default function shouldInstrument( | |
return true; | ||
} | ||
|
||
if (config.testRegex && filename.match(config.testRegex)) { | ||
if ( | ||
config.testRegex && | ||
new RegExp(replacePathSepForRegex(config.testRegex)).test(filename) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't we normalize this in normalize.js? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes please. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Moved to normalize and dropped from search_source as well. |
||
) { | ||
return false; | ||
} | ||
|
||
|
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 need to stick /__tests__/ in backticks (or escape using backslash as I've done in this comment), if not markdown looks really weird