-
Notifications
You must be signed in to change notification settings - Fork 400
Add custom reporter to reduce the test output #5872
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
Conversation
33bf069
to
1bb0447
Compare
Codecov Report
@@ Coverage Diff @@
## master mozilla/addons-frontend#5872 +/- ##
==========================================
+ Coverage 97.72% 97.72% +<.01%
==========================================
Files 228 228
Lines 5763 5764 +1
Branches 1105 1105
==========================================
+ Hits 5632 5633 +1
Misses 116 116
Partials 15 15
Continue to review full report at Codecov.
|
1bb0447
to
7a1592e
Compare
rebased. |
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.
I say this is ready to ship once it has a name.
This is pretty good! Some notes:
- I wanted it to only show the output for a failing test but it shows the output for the whole suite. This is better than before but less than ideal.
- When I run a single test (in watch mode I type
t
and then filter by test spec), it doesn't show any output at all. This is what was mentioned in jestjs/jest#6441 . I chased this down a bit until I finally realized that without your custom reporter, it still doesn't even show output. So, yeah, it's a bummer but this means at least your reporter isn't making things worse. - The buffering code in Jest is really complicated so I don't know if we'll ever get grouped output as requested in jestjs/jest#2080 .
jest.config.js
Outdated
// Replaces the following formats with an empty module. | ||
'^.+\\.(scss|css|svg|woff|woff2|mp4|webm)$': '<rootDir>/tests/emptyModule', | ||
}, | ||
reporters: ['<rootDir>/tests/fingers-crossed-reporter.js'], |
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.
I think it's ready for a proper name! I'd suggest putting it in a directory called tests/jest-reporters/
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.
Isn't it already a proper name? We hope we won't need to output console logs, that's the idea behind this name :) It is borrowed from https://github.com/Seldaek/monolog/blob/master/src/Monolog/Handler/FingersCrossedHandler.php#L19
Yep I saw that too, but it is better than absolutely all logs. We don't have too many test cases per test suite. It is a baby step toward a better developer experience. |
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.
I thought the name was just a placeholder while you got it working but I get it now. The comment above the reporter explains what it does so 🤷♀️
Maybe consider spinning this off into its own module so other people can easily take advantage of it? |
Not sure, it works well for us in this project but I am not sure it is generic enough to be reused elsewhere. |
Fix mozilla/addons#10682
⚠️ depends on #5871
That works on my machine™️ Maybe we should test this reporter, but I don't really know how. I guess we'll notice when things will break :D