cypress-parallel
cypress-parallel copied to clipboard
parallel-weights.json not generated
When cypress-parallel is running in a Docker container that exits immediately after having completed the tests suites, it never writes the file parallel-weights.json because the process terminate before.
I think that the problem it's caused by using asynchronous write API to write the file.
function generateWeightsFile(specWeights, totalDuration, totalWeight) {
Object.keys(specWeights).forEach((spec) => {
specWeights[spec].weight = Math.floor(
(specWeights[spec].time / totalDuration) * totalWeight
);
});
const weightsJson = JSON.stringify(specWeights);
fs.writeFile(`${settings.weightsJSON}`, weightsJson, 'utf8', (err) => {
if (err) throw err;
console.log('Generated file parallel-weights.json.');
});
}
I have changed this function and apparently works:
function generateWeightsFile(specWeights, totalDuration, totalWeight) {
Object.keys(specWeights).forEach((spec) => {
specWeights[spec].weight = Math.floor(
(specWeights[spec].time / totalDuration) * totalWeight
);
});
const weightsJson = JSON.stringify(specWeights);
fs.writeFileSync(`${settings.weightsJSON}`, weightsJson, 'utf8');
}function generateWeightsFile(specWeights, totalDuration, totalWeight) {
Object.keys(specWeights).forEach((spec) => {
specWeights[spec].weight = Math.floor(
(specWeights[spec].time / totalDuration) * totalWeight
);
});
const weightsJson = JSON.stringify(specWeights);
fs.writeFileSync(`${settings.weightsJSON}`, weightsJson, 'utf8');
}
I've put up a PR for this issue here https://github.com/tnicola/cypress-parallel/pull/73
@delmorof Should be fixed now in 0.7.0, thanks @brady727
Hi @tnicola
I'm a beginner in Cypress and currently trying to implement Parallel execution in my project. Since I do not have a distributed environment, hence trying to have parallel execution locally.
Came across your solution for this and after doing npm i cypress-parallel, I still don't see the parallel-weights.json being generated(considering the latest version 0.7.0). And when I run my npm run cy:parallel script, I see below message on terminal Weights file not found in path cypress/parallel-weights.json and the tests are not running in parallel in fact there is only 1 instance of browser opening.
Could you please help me overcome this issue.
TIA.
I am using version 0.9.0, and I'm getting the same error "Weights file not found in path cypress/parallel-weights.json." please replay how to resolve this issue.
I am using version 0.9.0, and I'm getting the same error "Weights file not found in path cypress/parallel-weights.json." please replay how to resolve this issue.
Any idea when the problem will be solved?
I encountered this issue, but I have already resolved it. Here is my solution: I relocated the specs directory to a specific folder that only contains spec files, with no sub-folders present