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

Dry run support #204

Open
kris-luminar opened this issue Nov 15, 2024 · 0 comments
Open

Dry run support #204

kris-luminar opened this issue Nov 15, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@kris-luminar
Copy link

kris-luminar commented Nov 15, 2024

Is your feature request related to a problem? Please describe.
I want to run a report of our current code coverage without actually executing all the tests.

Describe the solution you'd like

As of Mocha 9, it has as a --dry-run option. See https://mochajs.org/#-dry-run

Can we add support for this Mocha option?

Describe alternatives you've considered

I wrote a shell script to create an html file but it doesn't handle multi-line skipped tests

describe.skip('this is correctly left out of the report', ...
  it('this is incorrectly included in the report

It also fails to address JavaScript variable interpolation in the messages provided to it(), describe(), context()`.

This is an excerpt from the simple the bash script I wrote as a workaround.

listSpecsForProject() {
  grep -hr "describe(\| context(\| it(" $1 \
    | grep -v "^ *//" \
    | sed -E "s/( *)(describe)\('(.*)',.*/<h3>\3<\/h3>/g" \
    | sed -E "s/( *)(describe)\(\"(.*)\",.*/<h3>\3<\/h3>/g" \
    | sed -E "s/( *)(describe)\(\`(.*)\`,.*/<h3>\3<\/h3>/g" \
    | sed -E "s/( *)(context)\('(.*)',.*/<h4>\3<\/h4>/g" \
    | sed -E "s/( *)(context)\(\"(.*)\",.*/<h4>\3<\/h4>/g" \
    | sed -E "s/( *)(context)\(\`(.*)\`,.*/<h4>\3<\/h4>/g" \
    | sed -E "s/( *)(it)\('(.*)',.*/<li>\3<\/li>/g" \
    | sed -E "s/( *)(it)\(\"(.*)\",.*/<li>\3<\/li>/g" \
    | sed -E "s/( *)(it)\(\`(.*)\`,.*/<li>\3<\/li>/g"
}

Additional context

Any dry run solution needs to address JavaScript variable interpolation in the messages provided to it(), describe(), context()`. I assume we'd get that for free with Mocha's --dry-run option but haven't investigated.

@kris-luminar kris-luminar added the enhancement New feature or request label Nov 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant