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

add coverage tooling #152

Merged
merged 2 commits into from
Nov 14, 2023
Merged

add coverage tooling #152

merged 2 commits into from
Nov 14, 2023

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Nov 12, 2023

This is an exact copy of what we have in Plot (with the addition of ts files from src/).

Could help to increase coverage (#86).

calling yarn test:coverage outputs a coverage report in text format; it also creates a report in the lcov format, which can be used to display coverage gutters, for example.

Here's what the coverage looks like in text:
Capture d’écran 2023-11-12 à 01 11 05

And the coverage gutters:
Capture d’écran 2023-11-12 à 01 10 45

@Fil Fil requested a review from cinxmo November 12, 2023 00:13
@@ -25,9 +25,15 @@
"dev": "tsx watch ./src/preview.ts",
"build": "rm -rf dist && ./bin/observable.ts build",
"test": "yarn test:mocha && yarn test:lint",
"test:coverage": "npx c8 yarn test:mocha",
Copy link
Contributor

Choose a reason for hiding this comment

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

this is interesting - a combination of npx and yarn?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

npx loads c8, which then runs yarn test:mocha :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

for more see observablehq/plot#1818

Copy link
Contributor

@cinxmo cinxmo Nov 14, 2023

Choose a reason for hiding this comment

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

interesting... what's the benefit of this over npm i c8 --save-dev and then modifying "test:coverage": "c8 yarn test:mocha"? or yarn add c8 --dev

Copy link
Contributor Author

Choose a reason for hiding this comment

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

benefit is we don't install c8 if we don't check coverage

Copy link
Contributor

@cinxmo cinxmo left a comment

Choose a reason for hiding this comment

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

approving since it's the same as the Plot repo

@Fil Fil enabled auto-merge (squash) November 14, 2023 19:33
@Fil Fil merged commit b25f351 into main Nov 14, 2023
1 check passed
@Fil Fil deleted the fil/coverage branch November 14, 2023 19:37
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