Skip to content

Conversation

Aghassi
Copy link

@Aghassi Aghassi commented Sep 25, 2024

This addresses the ability to let users define their own coverage reporting logic in unique cases. For us, we use monocart-coverage-reporter. In doing so, we needed to write our own globalTeardown for jest that uses the split coverage logic, but also manipulates the dat files before they are passed to bazel

This addresses the ability to let users define their own coverage reporting logic in unique cases. For us, we use monocart-coverage-reporter. In doing so, we needed to write our own `globalTeardown` for jest that uses the split coverage logic, but also manipulates the dat files before they are passed to bazel
* also manipulating/massaging the `.dat` file before it gets
* passed to Bazel
*/
if (process.env.SKIP_SETTING_COVERAGE_DIR != "1") {
Copy link
Member

Choose a reason for hiding this comment

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

SKIP_SETTING_COVERAGE_DIR is a custom env var that you set on your jest_test targets?

Perhaps we expose this as a config attribute such as automatic_coverage_reporting which default to True but can be opted out of if you roll your own in a globalTeardown?

Copy link
Author

Choose a reason for hiding this comment

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

Yes because we source our jest_test from a macro that embeds that in env and then give everyone the same baseline jest.config that we provide which has globalTeardown set. I'm fine with a config attribute, but maybe scope it to be rules_jest_automatic_coverage_reporting so it's not so generic it could have other implications

Aghassi added a commit to Aghassi/rules_jest that referenced this pull request Jun 13, 2025
Attempts to solve aspect-build#294 through a rule attribute instead of an ENV variable
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants