After hook crashes if log files exist
csvan opened this issue · 3 comments
csvan commented
The following code in BaseOutputProcessor.js:
hasSpecChunkWritten(spec) {
return !!this.specChunksWritten[spec];
}
will throw if a log file for the current spec already exists in the output folder. This is because the following doesn't get invoked:
if (!fs.existsSync(this.file)) {
this.prepareForWrite();
}
Due to this, this.specChunksWritten
is never initialized before hasSpecChunkWritten
tries to access it.
archfz commented
Do you have steps to reproduce so we can write a test for this case?
csvan commented
- Add a standard Cypress setup with at least one spec file -
integration/myTest.spec.js
- Add to plugins:
require('cypress-terminal-report/src/installLogsPrinter')(on, {
outputRoot: 'cypress/',
specRoot: 'cypress/integration',
printLogsToFile: 'always', // <--- so that we always try to access the file
printLogsToConsole: 'never',
outputTarget: {
'logs|txt': 'txt',
'logs|json': 'json',
},
});
Add to support:
require('cypress-terminal-report/src/installLogsCollector')();
-
add
myTest.txt
to cypress/logs -
run cypress
archfz commented
Released in 2.3.1