When all spec.js files passes raport is generated and everything is okey. When just one or more of tests fails there is something weird going on. There is many warnings and errors but report is generated.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress-tests@1.0.0 scripts-chrome: cypress run --browser chrome --config-file config.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress-tests@1.0.0 scripts-chrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_56_823Z-debug.log
cypress-tests@1.0.0 posttest-chrome C:\Users\dk\Cypress
npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
Error: Pattern cypress/reports/current/mocha/.json matched no report files
at C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\index.js:14:11
at Array.map ()
at C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\utils.js:3:46
at merge (C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\index.js:82:17)
at Object. (C:\Users\dki\Cypress\node_modules\mochawesome-merge\bin\mochawesome-merge.js:32:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress-tests@1.0.0 combine-reports-chrome: `mochawesome-merge cypress/reports/current/mocha/.json > cypress/reports/current/chrome/mochareports/report.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress-tests@1.0.0 combine-reports-chrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_59_516Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress-tests@1.0.0 posttest-chrome: npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress-tests@1.0.0 posttest-chrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_59_535Z-debug.log
COMPLETE LOG
22 silly lifecycle cypress-tests@1.0.0~posttest-chrome: Returned: code: 1 signal: null
23 info lifecycle cypress-tests@1.0.0~posttest-chrome: Failed to exec posttest-chrome script
24 verbose stack Error: cypress-tests@1.0.0 posttest-chrome: npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
24 verbose stack Exit status 1
24 verbose stack at EventEmitter. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
24 verbose stack at EventEmitter.emit (events.js:315:20)
24 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
24 verbose stack at ChildProcess.emit (events.js:315:20)
24 verbose stack at maybeClose (internal/child_process.js:1021:16)
24 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
25 verbose pkgid cypress-tests@1.0.0
26 verbose cwd C:\Users\dk\Cypress
27 verbose Windows_NT 10.0.19043
28 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "test-chrome"
29 verbose node v12.18.4
30 verbose npm v6.14.6
31 error code ELIFECYCLE
32 error errno 1
33 error cypress-tests@1.0.0 posttest-chrome: npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
33 error Exit status 1
34 error Failed at the cypress-tests@1.0.0 posttest-chrome script.
34 error This is probably not a problem with npm. There is likely additional logging output above.
35 verbose exit [ 1, true ]
Code Reproduce
My script:
I am using powershell scripts to archive my reports.
Write-Host 'Archiving report ...'
# In the case of directories, forcing them does not clear out existing contents,
# it only suppresses the error message saying it's already created.
# This command will also create any intervening folders necessary,
# and the contents of those folders are also safe if they already exist. – John Neuhaus
$null = New-Item -ItemType Directory -Force -Path .\cypress\reports\archives\chrome
copy-item ".\cypress\videos" -destination ".\cypress\reports\current\chrome" -Recurse
copy-item ".\cypress\downloads" -destination ".\cypress\reports\current\chrome" -Recurse
$null = copy-item ".\cypress\reports\current\mocha" -destination ".\cypress\reports\current\chrome" -Recurse
$null =copy-item "cypress\reports\current\chrome" -destination "cypress\reports\archives\chrome" -Recurse
Rename-Item -Path "cypress\reports\archives\chrome\chrome" -NewName $(get-date -f yyyy-MM-dd-HH-mm-ss)
#Remove-Item ".\cypress\reports\current\mocha" -Recurse
Write-Host 'Archiving complete'
//pretest
Write-Host '> checking if directory report/current exist'
**Describe the bug
When all spec.js files passes raport is generated and everything is okey. When just one or more of tests fails there is something weird going on. There is many warnings and errors but report is generated.
// example.js
when test3 is uncommented:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cypress-tests@1.0.0 scripts-chrome:
cypress run --browser chrome --config-file config.json
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cypress-tests@1.0.0 scripts-chrome script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_56_823Z-debug.log
✓ Reports saved: C:\Users\dk\Cypress\cypress\reports\current\chrome\mochareports\report.html Archiving report .. Archiving complete
ERROR: Failed to merge reports
Error: Pattern cypress/reports/current/mocha/.json matched no report files at C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\index.js:14:11 at Array.map ()
at C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\utils.js:3:46
at merge (C:\Users\dk\Cypress\node_modules\mochawesome-merge\lib\index.js:82:17)
at Object. (C:\Users\dki\Cypress\node_modules\mochawesome-merge\bin\mochawesome-merge.js:32:1)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! cypress-tests@1.0.0 combine-reports-chrome: `mochawesome-merge cypress/reports/current/mocha/ .json > cypress/reports/current/chrome/mochareports/report.json`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the cypress-tests@1.0.0 combine-reports-chrome script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_59_516Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! cypress-tests@1.0.0 posttest-chrome:
npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the cypress-tests@1.0.0 posttest-chrome script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\dk\AppData\Roaming\npm-cache_logs\2021-10-29T11_13_59_535Z-debug.log
COMPLETE LOG
22 silly lifecycle cypress-tests@1.0.0~posttest-chrome: Returned: code: 1 signal: null 23 info lifecycle cypress-tests@1.0.0~posttest-chrome: Failed to exec posttest-chrome script 24 verbose stack Error: cypress-tests@1.0.0 posttest-chrome: (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
24 verbose stack at EventEmitter.emit (events.js:315:20)
24 verbose stack at ChildProcess. (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
24 verbose stack at ChildProcess.emit (events.js:315:20)
24 verbose stack at maybeClose (internal/child_process.js:1021:16)
24 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
25 verbose pkgid cypress-tests@1.0.0
26 verbose cwd C:\Users\dk\Cypress
27 verbose Windows_NT 10.0.19043
28 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "run" "test-chrome"
29 verbose node v12.18.4
30 verbose npm v6.14.6
31 error code ELIFECYCLE
32 error errno 1
33 error cypress-tests@1.0.0 posttest-chrome:
npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
24 verbose stack Exit status 1 24 verbose stack at EventEmitter.npm run combine-reports-chrome && npm run generate-report-chrome && @powershell -NoProfile -ExecutionPolicy Unrestricted -Command ./posttest-chrome.ps1
33 error Exit status 1 34 error Failed at the cypress-tests@1.0.0 posttest-chrome script. 34 error This is probably not a problem with npm. There is likely additional logging output above. 35 verbose exit [ 1, true ]Code Reproduce
My script:
I am using powershell scripts to archive my reports.
//package.json
//posttest-chrome.ps1
//pretest Write-Host '> checking if directory report/current exist'
$null = New-Item -ItemType Directory -Force -Path .\cypress\reports\current
//cypres.json
Environment (please complete the following information):