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

Question about: Some test suites likely terminated without passing on results #90

Open
aram-bigid opened this issue Mar 8, 2022 · 23 comments · May be fixed by #203
Open

Question about: Some test suites likely terminated without passing on results #90

aram-bigid opened this issue Mar 8, 2022 · 23 comments · May be fixed by #203
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@aram-bigid
Copy link

Hi,

First off, thanks for the repo and work :)

So i want to use this package in our tests, but am seeing the following error randomly on my test runs:
Some test suites likely terminated without passing on results

I know that it's a validation, but do we know why this is happening?

Thanks,
-arnon

@tnicola tnicola added help wanted Extra attention is needed question Further information is requested labels Mar 20, 2022
@mahanthi-arun-kumar
Copy link

I am also facing a similar kind of issue,
Found test suites does not match results.
Test suites found: 1036
Test suite results: 44
Some test suites likely terminated without passing on results, exit with error

This is the error I am getting:
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] cypress:parallel: cypress-parallel -s cypress:run -t 2 -d './src' -a '"--config baseUrl=http://localhost:3000 integrationFolder=src testFiles=**/integration-test/*cypress.js" '`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] cypress:parallel 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! /Users/maarunkumar/.npm/_logs/2022-03-26T05_14_05_325Z-debug.log`

@ronit15
Copy link

ronit15 commented Apr 11, 2022

I am also facing same issue any updates?

@Oryhara
Copy link

Oryhara commented May 12, 2022

Mahanthi-arun-kumar, I believe your problem is in the command line for cypress-parallel.
"-d './src'" tells cypress-parallel to look in your src directory for cypress test suite files. cypress-parallel treats every file it finds as a test suite file. Hence "Test suites found: 1036" that is every code file in your src directory. in your -a arguments passed to cypress itself, you declare testFiles=**/integration-test/*cypress.js" which tells cypress where to find test suite files. further, cypress can distinguish between files that contain tests and files which do not. This accounts for Test suite results: 44 You likely only have 44 test suites.
But cypress-parallel thinks you have 1036 test suites, and so expects 1036 test suite results. Upon getting less than 1036 results, it throws an error.
If you only pass directories which contain only cypress test suite files to cypress-parallel, that should fix your problem. I ran into this same issue and that fixed it for me.

@olga-govor
Copy link

I passed correct tests directory with correct regexp and in 95% tests pass without any issues. But sometimes randomly I've got results like
Found test suites does not match results. Test suites found: 71 Test suite results: 61 Some test suites likely terminated without passing on results, exit with error

It mentions specific suites that were not found, but I see results for these suites. Any ideas why it could happen?

@Densf2
Copy link

Densf2 commented Aug 8, 2022

Also tests failed with the same message in console ^^ - if launch by specific tag.

@chojnicki
Copy link

@tnicola is this package abandoned? Maybe someone has working fork?

This script should using glob/pattern for spec files, there is no reason to do this differently than Cypress itself. I'm using Cypress for component testing, and like many other people I have spec files together with component files. All my specs are passing, but I'm still getting false error from cypress-parallel :/

@SaniaSid
Copy link

SaniaSid commented Jun 7, 2023

Any update on this one ? Facing this issue and there is no information on why this is happening
image

@prashantpundhir
Copy link

I am also facing similar issue, but for me, results shows only 0 even though tests are running successfully.
Any updates on this ticket?

@ezunigaf90
Copy link

Has anyone managed to solve/bypass this issue?

Still getting this issue on version 0.13.0

@olga-govor
Copy link

For us it was an issue with different threads that used the same results folder. After small update to put results in different folders for different threads (unfortunately it's hardcoded in source lib) we didn't meet these problem. For now 2nd month without this issue

@ezunigaf90
Copy link

ezunigaf90 commented Aug 25, 2023

Since we don't get answers here I've been digging through the code because I think this plugin is really nice and I think I found what the issue was for us...

First of all, the error I was getting is:

Found test suites does not match results. 
Test suites found: 68 
Test suite results: 0 
Some test suites likely terminated without passing on results, exit with error
The following tests suites are missing results: { test1, test2, ... all 68 files }

So, it was false failing even if all the tests passed and the statement triggering the error is this:

if (settings.strictMode && timeMap.size !== testSuitePaths.length) {

To make shorter the story, after debugging it I realized that for "some" unknown reason none of the tests was generating the .json file needed and created automatically by this plugin in order to output the results, it also creates a runner-results folder for that but basically it was empty after any execution and that's why Test suite results: 0 (timeMap.size). I continued debugging and found where this issue started to happen:

We have mochawesome, mocha-junit-reporter and cypress-multi-reporters, so our code looked like this:

cypress v10.11
mochawesome v6.2.2
cypress-multi-reporters v1.6.1
mocha-junit-reporter v2.0.2
cypress-parallel v0.13.0

Piece of our cm-desktop.config.js file
module.exports = defineConfig({
	e2e: {
	        specPattern: 'cypress/user/*.test.js',
		reporter: 'cypress-multi-reporters',
		reporterOptions: {
			configFile: 'cypress/config/user/reporter-config.json',
		}
	}
});

Our reporter-config.json file
{
  "reporterEnabled":"mochawesome, mocha-junit-reporter",
  "mochaJunitReporterReporterOptions":{
    "mochaFile":"cypress/results/user/dsk/user-[hash].xml"
  },
  "mochawesomeReporterOptions":{
    "reportDir":"cypress/results/user/dsk",
    "overwrite":false,
    "html":false,
    "json":true
  }
}

Our package.json scripts
"cm:dsk:user": "cypress run --config-file ./cypress/config/user/cm-desktop.config.js --browser chrome",
"cm:run:dsk:user:parallel": "cypress-parallel -s cm:dsk:user -t 4 -d ./cypress/user",

^ That way, I was getting the error... So, after almost a full day of trial and error, I found that when I was executing this way then the multi-reporter-config.json file generated by default by the plugin was writing this lines:

{
  "reporterEnabled": "cypress-parallel/json-stream.reporter.js, cypress-parallel/simple-spec.reporter.js"
}

So, it immediately made me think that my reporter and reporterOptions flag was not being read... why? I don't know the answer, I thought it should have worked but looks like it's not working in that way, maybe a bug?? anyway... this statement confirmed my theory:

if (settings.reporter) {

effectively it was not recognizing my reporting flags.

Note: I tried passing -r and -o and a lot of ways/combinations but can't make it work.

The solution? ... I made it work by doing this:

  1. Removed the reporter and reporterOptions flags from the cm-desktop.config.js file (yes, deleted those lines from there)
  2. Our reporter-config.json file now looks like this:
{
  "reporterEnabled":"mochawesome, cypress-parallel/json-stream.reporter.js, cypress-parallel/simple-spec.reporter.js, mocha-junit-reporter",
    "mochawesomeReporterOptions":{
      "reportDir":"cypress/results/user/dsk",
      "overwrite":false,
      "html":false,
      "json":true
    },
  "cypressParallelSimpleSpecReporterJsReporterOptions": {
    "reportDir": "runner-results"
  },
  "mochaJunitReporterReporterOptions":{
    "mochaFile":"cypress/results/user/dsk/user-[hash].xml"
  }
}
  1. Our package.json now look like this:
"cm:dsk:user": "cypress run --config-file ./cypress/config/user/cm-desktop.config.js --browser chrome",
"cm:run:dsk:user:parallel": "cypress-parallel -s cm:dsk:user -t 4 -d ./cypress/user -p 'cypress/config/user/reporter-config.json'",

I found that -p flag in the settings file:

.option('reporterOptionsPath', {

which is not documented in README but it was the correct for us, now I'm not passing a reporter flag and letting the reporter-config.json to drive the enabled reporters.

Hope it helps anyone to solve the issue, I don't know if it's a bug or a miss by me while following instructions but that's what it is.

cc @tnicola

@guychienll
Copy link

hi @ezunigaf90
May I know after your change above , has this issue happened again ?

@guychienll
Copy link

guychienll commented Oct 6, 2023

hi @olga-govor
May I know you said hardcoded part is to change runner-results/ folder path ? thanks !

@olga-govor
Copy link

olga-govor commented Oct 6, 2023

hi @guychienll
in lib/cli.js you can find such line of code const resultsPath = path.join(process.cwd(), 'runner-results');
So here the name of directory for results is hardcoded. I've added here parameter that could be added from command line, so now if I use this plugin for different types of tests run in one workspace it wrote results in different directories. After this we don't have problems with empty or not full results

So changes in settings.js

  • add option for CMD
    .option('runnerResults', { alias: 'x', type: 'string', description: 'Path where cypress results will be located' }
  • add read and default value for it
    runnerResults: argv.runnerResults ? argv.runnerResults : 'runner-default',

in cli.js:
const resultsPath = path.join(process.cwd(), settings.runnerResults);

in shared-config.js:
const resultsPath = path.join(process.cwd(), ${settings.runnerResults});

@guychienll
Copy link

hi @olga-govor thanks lots ! you are awesome !

@guychienll
Copy link

hi @olga-govor thank your reply ,
But I want to know how do you wrote the result in diff folder ?
If it's what you mean (the PR below has implementation),
How to trigger the command once and wrote results in different folders at the same time?
#176

@kganczarek
Copy link

Hello, any news on this? Im wondering how this can be fixed, it is a little annoying that same build is failing due to missing results. I'm running one testing procedure with multiple test suits split into 4 threads. Maybe there is any workaround?

@mattweberio
Copy link

The issue "Some test suites likely terminated without passing on results" can happen for valid reasons, such as the reason in the error message. However, this is a bug and essentially makes this library unusable without forking. We can verify that the test suite output results and the JSON file exist, but in the mocha folder, there is no JSON for it. As mentioned by another poster above, the tests are overwritten and they had to modify the source to use different folders. It would be nice to get a bug fix, but from what I gather, we're on our own if we decide to use this library.

@igorperic17
Copy link

This is too irritating, I would rather let the tests run longer than fail randomly.

Unfortunately, this was a deal breaker for us at https://coretex.ai so we are moving away from using cypress-parallel until this issue is fixed.

@ketteq-neon
Copy link

@olga-govor can you please share the npm script, how to store the execution of threads in different folders and merge them all for reporting purpose.

@olga-govor
Copy link

@ketteq-neon I'm not storing results of execution of threads in different folders as I don't need it. But as I use this plugin in one space for different types of tests I need to store results from different test types in different folders ( you can see in prev.comments how it was achieved)
As this plugin split by threads and you know in which thread are you (at least you have list of tests for each thread) you can place also some index of thread, so it can be used to identify folder for each thread

@kostiantynvoiku
Copy link

I have the same issue using @cypress/grep:

CYPRESS_grepTags=-@some-tag cypress-parallel -s cy:run -t 3 -d 'cypress/e2e/*.cy.ts'
...

Found test suites does not match results.
Test suites found: 14
Test suite results: 12
Some test suites likely terminated without passing on results, exit with error
The following test suites are missing results: cypress/e2e/test1.cy.ts,cypress/e2e/test2.cy.ts
 ELIFECYCLE  Command failed with exit code 1.

@SimeonC SimeonC linked a pull request Aug 5, 2024 that will close this issue
@SimeonC
Copy link

SimeonC commented Aug 5, 2024

Firstly, thanks for your work on this project! 🙂

I've raised this as a PR #203 to get this working with monorepos, and my solution is to enable reportDir value in the config with the following patch-package diff (which can be used while waiting for the PR to be merged)

.
└── apps/
    ├── settings-frontend/
    │   ├── cypress/
    │   │   ├── integration
    │   │   └── config/
    │   │       └── reporter-config.js
    │   └── cypress.config.cts
    └── other-app

reporter-config.js

module.exports = {
  reporterEnabled:
    'cypress-parallel/json-stream.reporter.js, cypress-parallel/simple-spec.reporter.js, mocha-junit-reporter',
  cypressParallelJsonStreamReporterJsReporterOptions: {
    reportDir: '../../runner-results',
  },
  mochaJunitReporterReporterOptions: {
    mochaFile: '../../junit/settings-frontend/collaboration-[hash].xml',
    testsuitesTitle: process.env.SEMAPHORE_JOB_NAME ?? 'cypress',
  },
};

Package patch diff

diff --git a/node_modules/cypress-parallel/json-stream.reporter.js b/node_modules/cypress-parallel/json-stream.reporter.js
index 14dea14..06e87f5 100644
--- a/node_modules/cypress-parallel/json-stream.reporter.js
+++ b/node_modules/cypress-parallel/json-stream.reporter.js
@@ -10,7 +10,7 @@ var constants = require('mocha/lib/runner').constants;
 var path = require('path');
 var fs = require('fs');
 
-const { resultsPath } = require('./shared-config');
+const { resultsPath: defaultResultsPath } = require('./shared-config');
 
 const { EVENT_SUITE_END } = constants;
 
@@ -43,7 +43,7 @@ function JSONStreamCustom(runner, options) {
   }
 
   runner.on(EVENT_SUITE_END, function () {
-    writeFile(cleanStatistics());
+    writeFile.apply(self, [cleanStatistics()]);
   });
 }
 
@@ -54,10 +54,11 @@ function calculateDuration(start, end) {
 }
 
 function writeFile(statistics) {
+  const resultsPath = this.options.reporterOptions.reportDir ? path.join(process.cwd(), this.options.reporterOptions.reportDir) : defaultResultsPath;
   // replace forward and backward slash with _ to generate filename
   const fileName = statistics.file.replace(/\\|\//g, '_');
   if (!fs.existsSync(resultsPath)) {
-    fs.mkdirSync(resultsPath);
+    fs.mkdirSync(resultsPath, { recursive: true });
   }
   const specResultPath = path.join(resultsPath, `${fileName}.json`);
   fs.writeFileSync(specResultPath, JSON.stringify(statistics, null, 2));
diff --git a/node_modules/cypress-parallel/utility.js b/node_modules/cypress-parallel/utility.js
index 0ed59c9..b0a725c 100644
--- a/node_modules/cypress-parallel/utility.js
+++ b/node_modules/cypress-parallel/utility.js
@@ -24,7 +24,12 @@ function generateWeightsFile(specWeights, totalDuration, totalWeight) {
   });
   const weightsJson = JSON.stringify(specWeights);
   try {
-    fs.writeFileSync(`${settings.weightsJSON}`, weightsJson, 'utf8');
+    const filepath = path.join(process.cwd(), settings.weightsJSON);
+    const directory = path.dirname(filepath);
+    if(!fs.existsSync(directory)) {
+      fs.mkdirSync(directory, { recursive: true });
+    }
+    fs.writeFileSync(filepath, weightsJson, 'utf8');
     console.log('Weights file generated.')
   } catch(e) {
     console.error(e)

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

Successfully merging a pull request may close this issue.