Repository navigation
Expand file tree
/
Copy pathcypress.config.js
More file actions
51 lines (48 loc) · 1.4 KB
/
Copy pathcypress.config.js
File metadata and controls
51 lines (48 loc) · 1.4 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { defineConfig } from "cypress"
import codeCoverageTask from "@cypress/code-coverage/task"
import fs from "fs-extra"
import path from "node:path"
import { fileURLToPath } from "node:url"
const root = path.dirname(fileURLToPath(import.meta.url))
export default defineConfig({
projectId: "vb97jp",
// default screen size for testing
viewportWidth: 1000,
viewportHeight: 660,
e2e: {
setupNodeEvents(on, config) {
codeCoverageTask(on, config)
on("task", {
setUpKartat: ({ config, php = "config-01" }) => {
const kartatPath = path.join(root, "kartat")
const setupPath = path.join(root, "cypress/fixtures", config)
fs.rmSync(kartatPath, { recursive: true, force: true })
fs.mkdirSync(kartatPath)
if (fs.existsSync(setupPath)) {
fs.copySync(setupPath, kartatPath)
}
// php config
const sourceConfig = path.join(root, "cypress/fixtures/php", php + ".php")
const destConfig = path.join(root, "rg2-config.php")
fs.copyFileSync(sourceConfig, destConfig)
return null
}
})
return config
},
expose: {
codeCoverage: {
exclude: "cypress/**/*.*"
}
},
component: {
devServer: {
bundler: "vite"
},
setupNodeEvents(on, config) {
codeCoverageTask(on, config)
return config
}
}
}
})