Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 5bac45b

Browse files
committedJun 10, 2024·
feat: Setup Cypress to work with vite
1 parent 67e2cb3 commit 5bac45b

File tree

4 files changed

+5124
-27
lines changed

4 files changed

+5124
-27
lines changed
 

‎cypress.config.ts

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
import { defineConfig } from 'cypress'
1+
import { resolve } from 'path';
2+
import { defineConfig } from 'cypress';
3+
import vitePreprocessor from 'cypress-vite';
24

35
export default defineConfig({
46
e2e: {
5-
// We've imported your old cypress plugins here.
6-
// You may want to clean this up later by importing these.
7-
setupNodeEvents(on, config) {
8-
return require('./cypress/plugins/index.js')(on, config)
7+
baseUrl: 'http://localhost:5173/',
8+
viewportWidth: 1280,
9+
viewportHeight: 768,
10+
specPattern: '**/*.e2e.ts',
11+
video: false,
12+
screenshotOnRunFailure: false,
13+
14+
setupNodeEvents(on) {
15+
on(
16+
'file:preprocessor',
17+
vitePreprocessor(resolve(__dirname, './vite.config.ts')),
18+
);
919
},
1020
},
11-
})
21+
});

‎cypress/plugins/index.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

‎package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"@vitejs/plugin-react-swc": "^3.7.0",
2424
"@vitest/coverage-v8": "^1.6.0",
2525
"cypress": "^13.11.0",
26+
"cypress-vite": "^1.5.0",
2627
"eslint": "^8",
2728
"eslint-plugin-react-hooks": "^4.6.2",
2829
"eslint-plugin-react-refresh": "^0.4.7",

‎pnpm-lock.yaml

Lines changed: 5107 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
Please sign in to comment.