Skip to content
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

ci: fix code coverage in github actions #741

Merged
merged 7 commits into from
Feb 1, 2023
Merged

Conversation

erunion
Copy link
Member

@erunion erunion commented Feb 1, 2023

🚥 Fixes #617

🧰 Changes

Code coverage in Github Actions is broken due to Jest, for whatever reason, not automatically creating code coverage directories. I was able to partialy fix this by first creating a coverage/ directory but even after chmod'ing with 777 permissions it still wouldn't create coverage/lconv-report/.

As coverage/lconv-report has a whole bunch of subdirectories that I have no desire to try to keep up with in a CI workflow, I've just changed our Jest code coverage to use a simpler reporter that dumps to the console.

Screen Shot 2023-02-01 at 11 19 38 AM

@erunion erunion added bug Something isn't working labels Feb 1, 2023
@erunion erunion marked this pull request as ready for review February 1, 2023 18:40
@erunion erunion requested a review from kanadgupta February 1, 2023 18:40
@@ -10,9 +11,8 @@ module.exports = {
statements: 90,
},
},
modulePaths: ['<rootDir>'],
Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't need to make this and the roots change to get coverage working, we just don't need to set those configs here. rootDir is good enough.

Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

omfg 👀 a couple questions just to confirm!

jest.config.js Outdated Show resolved Hide resolved
jest.config.js Outdated
coveragePathIgnorePatterns: ['/dist', '/node_modules'],
coverageDirectory: 'coverage',
coveragePathIgnorePatterns: ['<rootDir>/dist', '<rootDir>/node_modules'],
coverageReporters: ['text-summary'],
Copy link
Member

Choose a reason for hiding this comment

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

Is this line required for it to work again or could we bring back the table view?

Copy link
Member Author

Choose a reason for hiding this comment

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

Changed this to text and it brought back the table view.

Screen Shot 2023-02-01 at 11 19 38 AM

You're just going to lose the lcov reporter that generates the fancy HTML page but I don't know if you ever used that locally or not. https://istanbul.js.org/docs/advanced/alternative-reporters/

@erunion erunion requested a review from kanadgupta February 1, 2023 19:23
Copy link
Member

@kanadgupta kanadgupta left a comment

Choose a reason for hiding this comment

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

🥩🥩🥩

@kanadgupta kanadgupta merged commit 968c653 into main Feb 1, 2023
@kanadgupta kanadgupta deleted the fix/code-coverage branch February 1, 2023 20:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Jest coverage is broken in GitHub Actions
2 participants