yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.45k stars 2.73k forks source link

Coverage runs with error exit code 1 #6466

Open palaniichukdmytro opened 6 years ago

palaniichukdmytro commented 6 years ago

Bug

What is the current behavior? I get an error error Command failed with exit code 1. during my cover test.

My test scripts

"cover": "cross-env NODE_ENV=test nyc --reporter=cobertura --reporter=html --reporter=text-summary node_modules/mocha/bin/_mocha --reporter mocha-junit-reporter --reporter-options mochaFile=../Televic.Mirfus/TestOutput/JUnitResults/ui-unit-tests.xml",
$ yarn cover
yarn run v1.10.1
$ cross-env NODE_ENV=test nyc --reporter=cobertura --reporter=html --reporter=text-summary node_module
s/mocha/bin/_mocha --reporter mocha-junit-reporter --reporter-options mochaFile=../Televic.Mirfus/Test
Output/JUnitResults/ui-unit-tests.xml
Warning: React depends on requestAnimationFrame. Make sure that you load a polyfill in older browsers.
 https://fb.me/react-polyfills

=============================== Coverage summary ===============================
Statements   : 99.65% ( 3715/3728 )
Branches     : 98.78% ( 1700/1721 )
Functions    : 99.48% ( 1542/1550 )
Lines        : 99.6% ( 3250/3263 )
================================================================================
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

What is the expected behavior? Do not produce error

Please mention your node.js, yarn and operating system version. yarn v1.10.1 node v10.10.0 npm v6.4.1 windows 10

rally25rs commented 6 years ago

I believe this would indicate that the script you are running is returning a non-0 exit code. What is the exit code if you run the same command outside of yarn?

Without seeing how your project is set up, I'm assuming cross-env and nyc are dependencies so they should have bin files in node_modules/.bin, making the equivalent command something like

node_modules/.bin/cross-env NODE_ENV=test node_modules/.bin/nyc --reporter=cobertura --reporter=html --reporter=text-summary node_modules/mocha/bin/_mocha --reporter mocha-junit-reporter --reporter-options mochaFile=../Televic.Mirfus/TestOutput/JUnitResults/ui-unit-tests.xml

I think on Windows you can then get the last command's exit code by running

echo %errorlevel%
palaniichukdmytro commented 6 years ago

I did it in VS code terminal, when I tried in cmd it disapered

palaniichukdmytro commented 6 years ago

Looks like it does not belong to yarn or node

rally25rs commented 6 years ago

Weird. I'm not sure why it would be different. I don't see a difference on OSX VSCode, but I don't have my Windows machine with me right now to test anything on Win.