Remove videos of successful runs

This commit is contained in:
Sebastian Sdorra
2020-08-26 08:48:43 +02:00
parent 06ecfd786e
commit 2f7ff72fd1
3 changed files with 28 additions and 3 deletions

View File

@@ -0,0 +1,22 @@
const cypress = require("cypress");
const fs = require("fs");
const path = require("path");
const options = {
reporter: "junit",
reporterOptions: {
mochaFile: path.join("..", "target", "cypress-reports", "TEST-[hash].xml")
}
};
cypress
.run(options)
.then(results => {
results.runs.forEach(run => {
// remove videos of successful runs
if (!run.shouldUploadVideo) {
fs.unlinkSync(run.video);
}
});
})
.catch(err => console.error(err));