Skip to content
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

Merged
merged 3 commits into from
Feb 15, 2018
Merged

Conversation

jwbay
Copy link
Contributor

@jwbay jwbay commented Feb 14, 2018

Summary

Test files on windows shouldn't get instrumented given a testRegex like "/__tests__/*.js"

This matches what jest-cli does here https://github.com/facebook/jest/blob/c5fbd304c462e3c74c6cc5f5e7484e466c10521e/packages/jest-cli/src/search_source.js#L94

Test plan

Removed SkipOnWindows from the coverage_remapping integration test, which was failing for this reason, so green Appveyor.

so test files don't get instrumented on windows given a pattern like /__tests__/*.js
if (config.testRegex && filename.match(config.testRegex)) {
if (
config.testRegex &&
new RegExp(replacePathSepForRegex(config.testRegex)).test(filename)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we normalize this in normalize.js?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes please.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to normalize and dropped from search_source as well.

CHANGELOG.md Outdated
### Fixes

* `[jest-runtime]` Replace path sep for testRegex in should_instrument so test
files don't get instrumented on windows given a pattern like /__tests__/*.js
Copy link
Member

@SimenB SimenB Feb 14, 2018

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

Copy link
Collaborator

@thymikee thymikee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is way nicer, thanks!

@cpojer cpojer merged commit 146900f into jestjs:master Feb 15, 2018
@cpojer
Copy link
Member

cpojer commented Feb 15, 2018

Loving all the windows fixes, keep 'em coming.

@github-actions
Copy link

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.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants