Skip to content

Add code coverage for tests #28

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

Closed
zbraniecki opened this issue Apr 18, 2017 · 7 comments · Fixed by #290
Closed

Add code coverage for tests #28

zbraniecki opened this issue Apr 18, 2017 · 7 comments · Fixed by #290

Comments

@zbraniecki
Copy link
Collaborator

It would help me to work with the parser tests to know how much of the parser is covered with tests. Istanbul seems like a good candidate? https://github.com/gotwarlost/istanbul

@stasm
Copy link
Contributor

stasm commented Apr 18, 2017

I tried running the following commands:

npm install istanbul
cd fluent
../node_modules/.bin/istanbul cover ../node_modules/.bin/_mocha -- -u tdd -r test/setup.js

which according to gotwarlost/istanbul#44 (comment) should work. Unfortunately I got:

No coverage information was collected, exit without writing coverage information

@stasm
Copy link
Contributor

stasm commented Apr 18, 2017

I'd like to have coverage reports as well. I'll try to get this working today or tomorrow.

@stasm
Copy link
Contributor

stasm commented Apr 18, 2017

Looks like npm installs istanbul v0.4.5 by default. Installing v1.1.0-alpha.1 fixes the above issue.

I managed to get coverage reports working for all packages except for fluent-syntax. I'm getting a weird ReferenceError: Function is not defined. I'll dig some more.

@stasm stasm mentioned this issue Apr 18, 2017
@Pike
Copy link
Contributor

Pike commented Apr 18, 2017

I'd argue that instanbul isn't a good candidate, looking at the state of releases that project had in the last year (effectively none, and it might be that 1.1.0 alpha 1 is actually older than 0.4.5)

@stasm
Copy link
Contributor

stasm commented Apr 18, 2017

Do you know any alternatives? I found blanket which isn't maintained anymore; the author recommends istanbul.

@stasm
Copy link
Contributor

stasm commented Sep 1, 2017

Istanbul is now maintained in https://github.com/istanbuljs and is at version 1.1.2. I gave it another try but ran into a coupe of issues:

  • There's a bug in Istanbul which makes it crash when it sees the Function class in fluent-syntax/src/ast.js. We could possibly rename that class or exclude that file from the coverage report.

  • The results for fluent/src/{parser,resolver}.js looks as if there was unclosed <span class="cstat-no"> element in the result: it's all red after a point.

@zbraniecki, I don't want to spend too much on this right now. I pushed my WIP branch to https://github.com/stasm/fluent.js/tree/istanbul. Feel free to take over if you have cycles for this.

@stasm
Copy link
Contributor

stasm commented Oct 12, 2018

One year and 12 major releases of istanbul later, creating coverage reports is as simple as running nyc mocha rather than mocha :) See #290.

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 a pull request may close this issue.

3 participants