-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcypress.config.ts
36 lines (35 loc) · 1009 Bytes
/
cypress.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { defineConfig } from "cypress";
import * as fs from "fs";
export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
on("task", {
log(message: any) {
console.log(message);
return null;
},
table(message: any) {
console.table(message);
return null;
},
}),
on(
"after:spec",
(spec: Cypress.Spec, results: CypressCommandLine.RunResult) => {
if (results && results.video) {
// Do we have failures for any retry attempts?
const failures = results.tests.some((test) =>
test.attempts.some((attempt) => attempt.state === "failed"),
);
if (!failures) {
// delete the video if the spec passed and no tests retried
fs.unlinkSync(results.video);
}
}
},
);
},
baseUrl: "http://localhost:3000",
video: true,
},
});