-
-
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
Add testFilePath to test context #7536
Comments
Here is the background: I want to capture video via devtools (in puppeteer) and generate subtitle under my custom reporter. Each test file should generate 2 files, one mkv video and one srt subtitle. The video capture must be captured in jest environment because in reporter we cannot access puppeteer environment. The subtitle must be generated in reporter because only in reporter we could collect test results. Now the problem is in jest environment there is no way to figure out current test file path, so the jest environment don't know the correct path for the video. I've tried to copy path from reporter context to global in reporter's onTestStart() so that jest environment could collect the test file path from global. It works if --runInBand is enabled, but not works without the flag. If there are some way else to handle my scenario please let me know. Thanks! |
Another approach I've tried is to 'steal' the path via argument.callee.caller in jest environment. That doesn't work because strict mode is enabled. |
This will be implemented via #7442, you can track that 🙂 |
Oh thanks! |
This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
🚀 Feature Proposal
It would be nice if the jest-environment could access test file path via test context
Motivation
Under the context of jest-environment we couldn't access the test file path, but I need it.
Example
Pitch
Why does this feature belong in the Jest core platform?
It can't be done by custom reporter because the reporter and the environment may not be in the same process thanks to jest-runner. There's almost no way to pass information between jest environment and jest reporter. If the jest environment could collect the test file path then they could communicate via some temporary file.
The text was updated successfully, but these errors were encountered: