-
-
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
Use jest reporters to report more events #4471
Comments
Would also like to add this to the feature request #4500 TL;DR - add a callback option in reporters for when an individual test starts and completes. |
@palmerj3 what is your usecase? |
@aaronabramov my main use case is to introduce some VCR tech into a testing suite and I want to be able to isolate VCR files per test. I'm able to do this with jasmine reporters but I get the feeling that jasmine reporters isn't the way to go since you've forked jasmine and created your own reporter API. I would worry about the long-term sustainability of that approach if I were to base my solution off jasmine reporters. |
@palmerj3 VCR you mean recording and replaying network requests? we always had and will probably have two reporting mechanisms.
both of them are in incomplete (probably 80% done) state and unfortunately i don't have time right now to focus on them :( |
@palmerj3 i'm pretty sure that is what you want https://github.com/facebook/jest/blob/master/packages/jest-circus/src/event_handler.js#L20-L81 |
@aaronabramov yes! If you have any suggestions or if there is something I can do to help build these things I'm more than happy to put in the time. |
How can a reporter access |
@segrey jest reporters don't have access to that information but jasmine reporters do. So if you use the jasmine reporter API then you can access per-test details. |
@palmerj3 Thanks for the quick reply! IIUC, a jasmine reporter should be specified via It'd be great to have such a capability in reporter API. @aaronabramov What do you think about optional reporting each |
Is there a way to pass a setup script via |
Just discovered a way to configure
Then, |
@segrey I most likely don't understand the full picture of what you're attempting. But wouldn't it be a lot easier to simply put all the imports for your setup script in a dir like tools/jest/jasmineSetup and then add |
@palmerj3 Sorry for being unclear. My case is developing a tool for Jest (IntelliJ IDEA / WebStorm Jest test runner). Running jest tests brings a test tree in UI. As tests are running, the tree is being updated: new tests are added as running nodes, passed tests are shown as green test nodes, failed - as red ones. The ealier the test node is added to the tree or updated, the better. However, currently tests results are available after all tests are run in a file ( |
@segrey can you open up a separate issue for setting |
@SimenB Desired behavior of |
Ah, interesting. That would be weird from a CLI API standpoint, wouldn't it? Not sure how
You can use To circle back to your original question:
Should be just |
@SimenB Probably you're right. The motivation is to not overwrite Currently, the integration uses |
@aaronabramov is still in progress and do we have any updates ? |
@aaronabramov It would be nice to have a lifecycle hook like jasmine's |
We're currently doubling down on getting jest-circus out the door (see the commits from today and yesterday), which will make this work pretty much out of the box. |
@SimenB is there a way to give this a try today with Happy to help work on this a bit if necessary, live individual test case reporting ala #6225 is a priority for me :) |
To run with circus, just install But if I understood @aaronabramov correctly in #6225 we need a way to bubble the result out of circus (which runs inside the vm) up into reporters (which runs outside of it), and some way of namespacing the event (as tests run in parallel). I guess keying by runner and test file path or something should be enough. Or just generate a uuid somewhere, but I think a deterministic key is best |
it's even more complicated than this :) we run circus outside the vm and only return to back to the worker when we completed the whole test run. getting granular events back to reporters will be a pretty challenging task. it'll also affect performance |
Thanks for the pointers I was able to get a hacked up version going (master...patrickhulce:report_progress), so looks very doable with circus, awesome! :) Last time I tried a PR to a FB project I got caught up in the CLA process with my employer, but let me know if I can help with anything else! |
@patrickhulce this is awesome! |
This issue is stale because it has been open for 1 year with no activity. Remove stale label or comment or this will be closed in 30 days. |
This issue was closed because it has been stalled for 7 days with no activity. Please open a new issue if the issue is still relevant, linking to this one. |
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. |
since we use a single instance of each reporter to report events from all projects/runners i though it would be helpful to report some more things, not only
onTestRunStart
,onTestResult
,onTestRunFinish
, etc, but also things likeonProcessStart
,onContextReady
and other things.I want to introduce some logging and performance monitoring, but there's no easy way to know how long each step of jest takes right now
The text was updated successfully, but these errors were encountered: