cypress-parallel
cypress-parallel copied to clipboard
Script failed when 'runner-results' folder not exist or if not empty
Hi,
in the start script, there is a line code that remove the 'runner-results' folder but the script throw an exception in 2 cases: -> when this folder not exist -> when this folder exist and it contains files
So before run the cmd, i must clean the folder or create a empty 'runner-results' folder. Could you handle this exception?
cypress-parallel -s cy:run -t 4 -d cypress/integration/ -p cypress-report-config.json
(node:30920) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, rmdir 'C:\Personal_Unsaved\Projet\front-end\runner-results'
at Object.rmdirSync (fs.js:684:3)
at cleanResultsPath (C:\Personal_Unsaved\Projet\front-end\node_modules\cypress-parallel\cli.js:19:6)
at start (C:\Personal_Unsaved\Projet\front-end\node_modules\cypress-parallel\cli.js:23:3)
at Object.
Hey @PBIIBP . I'm having the same problem and actually even if I create the empty runner-results
folder in the project's root dir, it's being deleted and then this error occurs.
Did you managed to overcome this issue somehow?
changing the cleanResultsPath method in node_modules/cypress-parallel/cli.js to the following did the trick for me:
function cleanResultsPath() { if(!fs.existsSync(resultsPath)) { fs.mkdirSync(resultsPath, { recursive: true }) } else { fs.readdir(resultsPath, (err, files) => { if (err) console.log(err); for (const file of files) { fs.unlink(path.join('path here', file), err => { if (err) console.log(err); }); } }); } }
@PBIIBP May be issue is with your cypress-report-config.json file. Can you share the json file ?
I encountered the same issue with version cypress-parallel 0.9.0 and cypress 9.4.1 project structure: project/cypress/integration/folder/test.spec.ts command: npx cypress-parallel -s dev -t 2 -d **/user.spec.ts OS: Windows 10 / powershell
Would be great if you can have a look @ISanjeevKumar
node:fs:1390 handleErrorFromBinding(ctx); ^
Error: ENOENT: no such file or directory, scandir 'C:\Users\user\dev\project\runner-results' at Object.readdirSync (node:fs:1390:3) at collectResults (C:\Users\user\dev\project\node_modules\cypress-parallel\utility.js:35:26) at start (C:\Users\user\dev\project\node_modules\cypress-parallel\cli.js:32:23) at processTicksAndRejections (node:internal/process/task_queues:96:5) { errno: -4058, syscall: 'scandir', code: 'ENOENT', path: 'C:\Users\user\dev\project\runner-results' }
I understood the problem now. it is getting failed because :
When none of the test case has got executed then report folder will not get created by 'json-stream.reporter', Hence you are getting this error.
Command which you are using looks not correct to me. Please use something like this '"node_modules/.bin/cypress-parallel -s dev -t 2-d '**/user.spec.ts'.
Note: json-stream.reporter will create report folder 'runner-result' only when a test case gets executed.
HI @ISanjeevKumar, sorry for the late response to your suggestion.
When none of the test case has got executed then report folder will not get created by 'json-stream.reporter', Hence you are getting this error.
I can confirm if none test cases are found this error will occour. In our case tests where executed but still the error will occour.
Command which you are using looks not correct to me. Please use something like this '"node_modules/.bin/cypress-parallel -s dev -t 2-d '**/user.spec.ts'.
This is exactly what npx does from my understanding. https://www.npmjs.com/package/npx I also double checked and with both execution ways the error occours.
I did some investigation today and can give the following result in return which lead to the error in our case.
- cypress-extends plugin in combination with our own cypress-multi-reporters configuration seems to colidate.
from cypress.json:
"reporter": "cypress-multi-reporters", "reporterOptions": { "configFile": "reporter-config.json" },
from cypress-env-dev.json:"extends": "./cypress.json", ...
from reporter-config.json:"reporterEnabled": "mochawesome, mocha-junit-reporter", "mochawesomeReporterOptions": { "reportDir": "cypress/reports/mochawesome/json", "reportFilename": "spec", "overwrite": false, "html": false }, "mochaJunitReporterReporterOptions": { "mochaFile": "cypress/reports/mocha-junit-reporter/spec_[hash].xml", "includePending": true, "jenkinsMode": true }
plugins/index.jsmodule.exports = (on, config) => { return require('@bahmutov/cypress-extends')(config.configFile); }
solution 1: as soon as the cypress-extends plugin is disabled in plugins/index.js and config files will not be merged. Additionally I have to configure the cypress-multi-reporters via cli. the configuration for cypress-multi-reporters from cypress-env-dev.json seems to be ignored.-r cypress-multi-reporters -o 'configFile=reporter-config.json
solution 2: delete your own cypress-multi-reporters config from cypress.json and it will also work like expected.
My question here is if it is intended that cypress-multi-reporters config from cypress.json will be ignored by default? Its at least not documented.
@nils-hoyer nils-hoyer
you only copy'n'pasted the runner config to a new file?
{ "reporterOptions": { "mochaFile": "tests/junitresults_integration-[hash].xml", "toConsole": true, "attachments": true } }
i tried but no luck. thats the script in package.json:
cypress-parallel -s cy:run -t 2 -d cypress/e2e/one/* -a '\"--browser electron --headed --reporter junit --config video=false\"' -r cypress-multi-reporters -o 'configFile=reporter-config.json
yes, I addressed the reporter-config.json from the cypress-parallel cli. two suggestions: make sure, you are not using cypress-extends plugin and not refer to report-config file from cypress config.
Sorry, doesn't seems to work for me. Even if I remove the reporter config complete.
ENOENT: no such file or directory, scandir ClientApp\node_modules\cypress-parallel\utility.js:35:26)
if you upload an example repo reproducing the error I can have a quick look on it.
I have this somewhat similar issue. Unfortunately i cannot share the repo is a customer project, but i run the build without parallel it works all fine on jenkins but everytime i try it out with parallel i get this error.
node:fs:1405
handleErrorFromBinding(ctx);
^
Error: ENOENT: no such file or directory, scandir '/home/jenkins/slave/workspace/some-project-folder/runner-results'
at Object.readdirSync (node:fs:1405:3)
at collectResults (/home/jenkins/slave/workspace/some-project-folder/node_modules/cypress-parallel/utility.js:35:26)
at start (/home/jenkins/slave/workspace/some-project-folder/node_modules/cypress-parallel/cli.js:32:23)
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -2,
syscall: 'scandir',
code: 'ENOENT',
this started to happen after cypress 10 upgrade, but works well with cypress 9
I am facing the same problem
Same problem. Will check up on the PR linked above.