forked from jpmorganchase/salt-ds
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cypress.config.ts
82 lines (79 loc) · 2.05 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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import { defineConfig } from "cypress";
import react from "@vitejs/plugin-react";
import tsconfigPaths from "vite-tsconfig-paths";
import IstanbulPlugin from "vite-plugin-istanbul";
import { isCI } from "ci-info";
import path from "path";
import { mergeConfig, UserConfig } from "vite";
import { version as reactVersion } from "react";
// @ts-ignore
import installCoverageTask from "@cypress/code-coverage/task";
import { cssInline } from "css-inline-plugin";
let viteConfig: UserConfig = {
plugins: [react(), tsconfigPaths(), IstanbulPlugin(), cssInline()],
define: {
"process.env": {},
},
server: {
watch: {
ignored: ["**/coverage"],
},
},
build: {
sourcemap: true,
},
resolve: {
alias: {
"cypress/react18": reactVersion.startsWith("18")
? "cypress/react18"
: "cypress/react",
},
},
};
if (isCI) {
viteConfig = mergeConfig(viteConfig, {
resolve: {
alias: {
"@salt-ds/core": path.resolve(__dirname, "./dist/salt-ds-core"),
"@salt-ds/data-grid": path.resolve(
__dirname,
"./dist/salt-ds-data-grid"
),
"@salt-ds/lab": path.resolve(__dirname, "./dist/salt-ds-lab"),
"@salt-ds/icons": path.resolve(__dirname, "./dist/salt-ds-icons"),
},
},
optimizeDeps: {
include: [
"@salt-ds/core",
"@salt-ds/data-grid",
"@salt-ds/lab",
"@salt-ds/icons",
],
},
} as UserConfig);
}
export default defineConfig({
viewportWidth: 1280,
viewportHeight: 1024,
video: false,
component: {
setupNodeEvents(on, config) {
installCoverageTask(on, config);
//Setting up a log task to allow logging to the console during an axe test because console.log() does not work directly in a test
on("task", {
log(message: string) {
console.log(message);
return null;
},
});
return config;
},
devServer: {
framework: "react",
bundler: "vite",
viteConfig,
},
specPattern: "packages/**/src/**/*.cy.{js,ts,jsx,tsx}",
},
});