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

Yet another "nothing covered" (with gulp-mocha 4.x) #115

Closed
cedx opened this issue Feb 20, 2017 · 9 comments
Closed

Yet another "nothing covered" (with gulp-mocha 4.x) #115

cedx opened this issue Feb 20, 2017 · 9 comments

Comments

@cedx
Copy link

cedx commented Feb 20, 2017

I'm using the "gulp-mocha" plugin to run my unit tests (which are ES6 modules processed by Babel). Everything worked fine until I decided to upgrade this plugin to the latest version (v4.0.0).

Now my coverage report is always empty. It seems that this new version of "gulp-mocha" does not play well with your plugin.

Any idea how I can restore the coverage report? Do you know any alternative?
I don't wish to downgrade the "gulp-mocha" plugin.

Here is my "gulpfile.js" (see the test tasks):
https://github.com/cedx/akismet.js/blob/master/gulpfile.js

@emuplz
Copy link

emuplz commented Feb 21, 2017

+1.

Both running istanbul from CLI or downgrading gulp-mocha to 3.x.x fixes the issue.

@SBoudrias
Copy link
Owner

SBoudrias commented Feb 21, 2017

gulp-mocha 4 doesn't run mocha in the same process (it spawns the mocha cli on the command line). As such, istanbul.hookRequire() won't work anymore.

I'm not sure how given the new gulp-mocha workflow you'd get this setup to work at all.

You can write the covered files to disk so mocha read them, but then I'm unsure how you'd go about retrieving the coverage data who'll be local to the mocha process and unaccessible.

@cedx
Copy link
Author

cedx commented Feb 21, 2017

Running istanbul from CLI [...] fixes the issue.
...
gulp-mocha 4 [...] spawns the mocha cli on the command line

The more I use Gulp, the less I can take advantage of its streaming possibilities 😥

@SBoudrias
Copy link
Owner

To be honest with you, I'm really rarely using gulp anymore. I find it easier to use tools with more built in capacity - like jest for testing, webpack for compilation, etc.

@cedx
Copy link
Author

cedx commented Feb 22, 2017

Finally fixed my issue by:

  • replacing gulp-mocha plugin by a direct call to the mocha CLI
  • replacing gulp-istanbul plugin by a direct call to nyc (aka the Istanbul CLI)

I still want to thank you @SBoudrias : your plugin has been very useful to me for a long time. Do I keep this issue open?

French PS (off-topic) : idem de mon côté Simon, je me rends compte qu'au fur et à mesure mes builds Gulp ne font plus grand'chose qu'appeler des binaires CLI... Je songe sérieusement à me contenter des scripts NPM pour lancer mes opérations de build, Gulp n'étant devenu qu'une surcouche presque inutile. Même si je ne vais vraisemblablement plus utiliser gulp-istanbul, encore une fois merci pour les efforts consacrés à ce plugin (je sais que s'investir dans l'Open Source est très chronophage, et ne rapporte pas grand'chose... à part l'estime de ses pairs).

@cedx
Copy link
Author

cedx commented Mar 20, 2017

I close this issue since the problem is not really related to this project.

@cedx cedx closed this as completed Mar 20, 2017
@pford68 pford68 mentioned this issue Jul 13, 2017
4 tasks
iimog added a commit to molbiodiv/biojs-io-biom that referenced this issue Jul 28, 2017
Otherwise no coverage reports are generated, see
SBoudrias/gulp-istanbul#115
vladimir-kotikov pushed a commit to microsoft/vscode-react-native that referenced this issue Sep 6, 2017
It appeared that gulp-mocha> 4.0 runs tests in a forked process so instanbul is not able to catch up coverage data

See SBoudrias/gulp-istanbul#115
vladimir-kotikov pushed a commit to microsoft/vscode-react-native that referenced this issue Sep 6, 2017
It appeared that gulp-mocha> 4.0 runs tests in a forked process so instanbul is not able to catch up coverage data

See SBoudrias/gulp-istanbul#115
webdevian pushed a commit to webdevian/generator-style-guider that referenced this issue Sep 13, 2017
bingnz added a commit to bingnz/cucumber-teamcity-formatter that referenced this issue Feb 10, 2018
Mocha 4 doesn't work properly with code coverage via Gulp (SBoudrias/gulp-istanbul#115).
@gsikorski
Copy link

gsikorski commented Mar 15, 2018

This issue is still referenced in the readme file, would be nice to keep it open or at least refer in the readme to the open issue in gulp-mocha module.

jlouns added a commit to jlouns/gulp-requirejs-optimize that referenced this issue Mar 24, 2018
Unable to update past 3.0.1 due to change in gulp-mocha operation.
see SBoudrias/gulp-istanbul#115 and sindresorhus/gulp-mocha#159.
@benedictchen
Copy link

Why is this still an issue?

Repository owner locked and limited conversation to collaborators Jun 14, 2018
@SBoudrias
Copy link
Owner

Locking conversation to prevent being spammed.

  1. gulp-istanbul cannot work with gulp-mocha@4.x.x. Architectural changes made to gulp-mocha made it stop using files inside the pipe, so it will run your tests, but doesn't work in a gulp way anymore.
  2. I do not use gulp anymore, and suggest you to drop it too. Alternative suggestions: use jest or mocha and nyc directly.
  3. If someone wants to maintains this project, you can reach out to me.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants