Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Setup before tests but after framework loads #7119
Setup before tests but after framework loads #7119
Changes from 8 commits
0691d94
a93d759
4e5b902
4910e56
07b6cba
51fe135
c9367f8
af4ac93
1177706
f532ef1
4801f37
d419af3
4c67fa3
ebb14c1
db2ce7e
7b322df
6ba2beb
6053897
cd8e2ae
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
This code will run setup files after any file set in
setupTestFrameworkScriptFile
. I wasn't sure how we want to handle this. Here are some ideas.setupTestFrameworkScriptFile
, only run the new config if set.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.
Hmm.. you bring up a good point! I lean more towards option 2 since both serve the same purpose. I can't think of a case where I would have both set in my configuration.
With that, another idea I'd like to suggest is that if both are set, we could log a warning indicating that
setupTestsAfterJest
is taking precedence, and thatsetupTestFrameworkScriptFile
is being ignored.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.
Just curious, how's the behaviour like if you pass in a wrong path to a file? Is that error handled or is that handled by the runtime. It would be good to gracefully handle that scenario
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.
What about changing line 77 to:
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.
@rickhanlonii Awesome. We would need to include info in the docs that mentions the module set using
setupTestFrameworkScriptFile
will run after any code set using the new configuration. If I do that, we should probably remove the original implementation ofsetupTestFrameworkScriptFile
in the lines above. Thoughts?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.
Yeah agreed, can probably add it to the doocs here https://jestjs.io/docs/en/configuration#setuptestframeworkscriptfile-string
What's the original implementation? Do you mean just line 77?