-
Notifications
You must be signed in to change notification settings - Fork 419
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
coverage flag with more ignore statements #632
base: master
Are you sure you want to change the base?
Conversation
This pull request is being automatically deployed with ZEIT Now (learn more). 🔍 Inspect: https://zeit.co/peg-js/pegjs/4hgcmifns |
I think, |
Sure... I was just doing for parity with the other booleans, but I've added a commit to revert that addition. |
Anything you need from me on this? |
@brettz9 Maybe add some tests to https://github.com/pegjs/pegjs/blob/master/test/behavior/generated-parser-behavior.spec.js? |
@YemSalat Tests are usually good, but tbh, in this case, it's probably not needed; the only way to reliably test if this option is working as intended is when NYC/Istanbul is running. @brettz9 I'm kind of overloaded with my work right now but have been (on my time off) working on a rewrite of the PEG.js library written in TypeScript (was intending to fix a bug in the new plugin system for 0.11 before finally releasing it, but sprawled out of control 😅). I'll leave this open for now so that I can decide later whether to merge this and then pull in the changes with merge conflicts to my WIP branch or add the changes directly in a later commit with reference to this PR. |
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
- Testing: Use CLI to ignore unneeded source for improving coverage of pegjs file
… to apply changes by hand as build does not otherwise get `pegjs` binary on the fork)
… to apply changes by hand as build does not otherwise get `pegjs` binary on the fork)
… to apply changes by hand as build does not otherwise get `pegjs` binary on the fork)
FWIW, in the course of linting another project, I've updated in adding some missing ignores. I'm finding it really invaluable to have something like this, adding missing tests and catching problems as a result. Look forward to your expected next release. |
… to apply changes by hand as build does not otherwise get `pegjs` binary on the fork)
Fixes #633
Add
--coverage
/--no-coverage
flags and add more ignore statements in generated outputPR type
Prerequisites
Description
While #546 added a few ignore statements into the generated output, I get the impression the focus of that PR was to add coverage support for maintenance of pegjs itself. This PR is oriented for the users of pegjs so that the generated parsers can be checked with the likes of
nyc
to ensure that the user's tests avoid a lot of noise from statements which will not or are unlikely to need coverage, while still covering the parser sufficiently.Some of the
ignore
statements are intended to suppress coverage warnings for pegjs boilerplate code, e.g., for functions that are only used when there are errors or with caching.One assumption I have made is that the the
else
of compile conditions can be ignored (the oneignore
statement which is forelse
rather thannext
). A lot of noise comes from such statements, and I would expect that a typical coverage scenario would only be interested in checking the presence of the parsed tokens. For projects which don't want this, this PR allows complete disabling ofignore
statements.I may well have missed some areas in which other
ignore
statements could also be added, and if possible, it would be helpful if someone more intimately familiar with the project could review, but in my testing with our own project, these changes were helpful in cutting out a lot of noise which was distracting from actual missing coverage.