-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
cypress.config.ts
47 lines (42 loc) · 1.49 KB
/
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
37
38
39
40
41
42
43
44
45
46
47
import { defineConfig } from "cypress";
import { readdirSync } from 'fs'
import { join } from 'path'
export default defineConfig({
projectId: 'imown1',
fixturesFolder: false,
viewportHeight: 800,
viewportWidth: 1200,
experimentalMemoryManagement: true,
e2e: {
supportFile: false,
baseUrl: "http://localhost:3000",
setupNodeEvents(on, config) {
on("task", {
"createFileTree"({ path }) {
// take the given path and create an array of all file paths
// with each files and the directory path of the file as strings
// for example: given 'accessibility' return
// ['accessibility/get-started/introduction', 'accessibility/core-concepts/how-it-works']
path = 'docs/' + path;
function walk(dir: string): string[] {
return readdirSync(dir, { withFileTypes: true }).flatMap((file) => {
if (file.name.includes('_category_.json') || file.name.includes('.DS_Store')) {
return []
}
if (file.name.includes('.mdx')) {
// remove the .mdx file extension
file.name = file.name.slice(0, -4)
}
if (file.isDirectory()) {
return walk(join(dir, file.name))
} else {
return [join(dir, file.name)]
}
})
}
return walk(path).filter((file) => file !== undefined).map((file) => file.slice(5))
}
})
}
},
});