yanghuabei / generator-es2017-npm-module

NPM module generator working with yeoman
MIT License
5 stars 3 forks source link

How do I run tests with coveralls? #1

Closed kristianmandrup closed 7 years ago

kristianmandrup commented 8 years ago

I've installed npm i -g babel-cli to get the babel-node binary, however when running npm test I also get an error.

I guess I need to somehow setup coveralls, which I never used before. Please update Readme with usage/install instructions thanks.

kristianmandrup commented 8 years ago

This is my error:

$ npm test --loglevel verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node',
npm verb cli   '/usr/local/bin/npm',
npm verb cli   'test',
npm verb cli   '--loglevel',
npm verb cli   'verbose' ]
npm info using npm@3.10.3
npm info using node@v6.7.0
npm verb run-script [ 'pretest', 'test', 'posttest' ]
npm info lifecycle mocha-dsl@0.1.0~pretest: mocha-dsl@0.1.0
npm info lifecycle mocha-dsl@0.1.0~test: mocha-dsl@0.1.0

> mocha-dsl@0.1.0 test /Users/kristianmandrup/repos/aurelia-projs/ai/mocha-dsl
> babel-node ./node_modules/.bin/isparta cover _mocha

npm verb lifecycle mocha-dsl@0.1.0~test: unsafe-perm in lifecycle true
npm verb lifecycle mocha-dsl@0.1.0~test: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/Users/kristianmandrup/repos/aurelia-projs/ai/mocha-dsl/node_modules/.bin:/usr/local/bin:/Users/kristianmandrup/anaconda/bin:/Users/kristianmandrup/Dropbox/Fuse-0.11/Contents/Linux:/Users/kristianmandrup/Dropbox/Fuse-0.11/Contents:/Users/kristianmandrup/Dropbox/Fuse-0.11/Contents/Mono/bin:/Users/kristianmandrup/Dropbox/Fuse-0.11/Contents/MonoBundle://anaconda/bin:/usr/local/bin:/Users/kristianmandrup/scala-2.11.7/bin:/Users/kristianmandrup/purescript:/Users/kristianmandrup/psc-ide:/Applications/xiki-master/bin:/usr/local/opt/android-sdk/tools:/Users/kristianmandrup/.rvm/gems/ruby-2.3.0/bin:/Users/kristianmandrup/.rvm/gems/ruby-2.3.0@global/bin:/Users/kristianmandrup/.rvm/rubies/ruby-2.3.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/npm/bin:/opt/X11/bin:/usr/local/git/bin:/usr/local/go/bin:/usr/local/MacGPG2/bin:/Users/kristianmandrup/.rvm/bin:/Users/kristianmandrup/npm/bin
npm verb lifecycle mocha-dsl@0.1.0~test: CWD: /Users/kristianmandrup/repos/aurelia-projs/ai/mocha-dsl
npm info lifecycle mocha-dsl@0.1.0~test: Failed to exec test script
npm ERR! Test failed.  See above for more details.
npm verb exit [ 1, true ]
kristianmandrup commented 8 years ago

I also notice that the src folder is compiled but not the test folder.

kristianmandrup commented 8 years ago

Also how can I run the tests without running coveralls. Would prefer if coveralls was an option in the generator and not hard coded.

yanghuabei commented 8 years ago

Would prefer if coveralls was an option in the generator and not hard coded.

Thanks for your suggestion. It's a good idea. I will finish it tommorw.

yanghuabei commented 7 years ago

@kristianmandrup

Sorry for later to fix the problem. I found the cause of test error is the latest version babel-preset-es2017. So i specified the version to 1.4.0 Temporarily. Please update the generator. I will check the preset to find the detail cause.

kristianmandrup commented 7 years ago

Thanks :)

yanghuabei commented 7 years ago

Hi, the error caused by latest babel-preset-es2017 was totally fixed in v1.1.2. I added es2015 and es2016 presets in generator.

kristianmandrup commented 7 years ago

Sweet :) Thanks! Good job!

kristianmandrup commented 7 years ago

Did you make coveralls optional? or at least better describe how to use it. Thanks!

yanghuabei commented 7 years ago

I didn't make coveralls optional. Coveralls is just a service to count and display coverage with an icon. It doesn't matter with test. So i decided not to make it optional. Coveralls uses the output of Mocha and Isparta as input to calculate coverage. In README.md, i added notes that describes how to use it combine with travis service.

kristianmandrup commented 7 years ago

Nice :)

Active coveralls service for your repository.

should be:

Activate coveralls service for your repository.

but how do I activate it? Please explain in README

yanghuabei commented 7 years ago

Activate coveralls service for your repository.

Sorry for my broken english. Sign in coveralls.io with your github account. Then you can activate coveralls service for your public repository.

Once build on travis is sucessful, command npm run coveralls will send its output to http://coveralls.io. If you have added specified image to your README, you can see coverage result like this.

image