Skip to content

Use NODE_PATH env var in jest config - #1272

Closed
EnoahNetzach wants to merge 2 commits into
react:masterfrom
EnoahNetzach:jest-node-path
Closed

Use NODE_PATH env var in jest config#1272
EnoahNetzach wants to merge 2 commits into
react:masterfrom
EnoahNetzach:jest-node-path

Conversation

@EnoahNetzach

Copy link
Copy Markdown
Contributor

Fixes#1271.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we exclude absolute paths here like we do in env.js?

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

You mean from process.env.NODE_PATH?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Yes. See #1194 for context.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

Yes, of course!

@EnoahNetzach
EnoahNetzachforce-pushed the jest-node-path branch 2 times, most recently from ec49e72 to 0ac094eCompareDecember 21, 2016 09:55
@gaearon

Copy link
Copy Markdown
Contributor

Hmm, this makes me confused. Isn't Jest already supposed to handle NODE_PATH? If mocking doesn't work it might be a Jest issue.

Also, I think this file would execute after ejecting, causing directory names to get hardcoded into package.json. I don't think it's the desired effect.

@gaearongaearon left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think this works as intended (see my comment).

@gor181

Copy link
Copy Markdown

This seems to work out of the box with react-scripts@1.0.7.
The line we have in is:

"test": "NODE_PATH=src react-scripts test --env=jsdom",

So I assume this can be closed?

@gaearon

Copy link
Copy Markdown
Contributor

Yep, it's been fixed. Thanks for reminding!

@gaearongaearon closed this Jun 26, 2017
@EnoahNetzach
EnoahNetzach deleted the jest-node-path branch June 26, 2017 16:27
@locklockBot locked and limited conversation to collaborators Jan 21, 2019
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@EnoahNetzach@gaearon@gor181@facebook-github-bot