Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit caa6bbd

Browse files
committed
test: broken cypress + vite
1 parent 7b69f12 commit caa6bbd

File tree

7 files changed

+676
-25
lines changed

7 files changed

+676
-25
lines changed

cypress.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"experimentalComponentTesting": true,
3+
"componentFolder": "packages",
4+
"pluginsFile": "./plugins.js",
5+
"testFiles": "**/*.test.*"
6+
}

cypress/fixtures/example.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "Using fixtures to represent data",
3+
"email": "[email protected]",
4+
"body": "Fixtures are a great way to mock data for responses to routes"
5+
}

cypress/support/commands.js

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// ***********************************************
2+
// This example commands.js shows you how to
3+
// create various custom commands and overwrite
4+
// existing commands.
5+
//
6+
// For more comprehensive examples of custom
7+
// commands please read more here:
8+
// https://on.cypress.io/custom-commands
9+
// ***********************************************
10+
//
11+
//
12+
// -- This is a parent command --
13+
// Cypress.Commands.add('login', (email, password) => { ... })
14+
//
15+
//
16+
// -- This is a child command --
17+
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
18+
//
19+
//
20+
// -- This is a dual command --
21+
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
22+
//
23+
//
24+
// -- This will overwrite an existing command --
25+
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })

cypress/support/index.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// ***********************************************************
2+
// This example support/index.js is processed and
3+
// loaded automatically before your test files.
4+
//
5+
// This is a great place to put global configuration and
6+
// behavior that modifies Cypress.
7+
//
8+
// You can change the location of this file or turn off
9+
// automatically serving support files with the
10+
// 'supportFile' configuration option.
11+
//
12+
// You can read more here:
13+
// https://on.cypress.io/configuration
14+
// ***********************************************************
15+
16+
// Import commands.js using ES2015 syntax:
17+
import './commands'
18+
19+
// Alternatively you can use CommonJS syntax:
20+
// require('./commands')

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
"@babel/preset-typescript": "^7.12.7",
4747
"@commitlint/cli": "^11.0.0",
4848
"@commitlint/config-conventional": "^11.0.0",
49+
"@cypress/react": "^5.2.0",
50+
"@cypress/vite-dev-server": "^1.1.0",
4951
"@testing-library/jest-dom": "^5.11.9",
5052
"@testing-library/user-event": "^12.6.2",
5153
"@testing-library/vue": "^6.3.4",
@@ -66,6 +68,7 @@
6668
"concurrently": "^5.3.0",
6769
"consola": "^2.15.0",
6870
"cross-env": "^7.0.2",
71+
"cypress": "^6.8.0",
6972
"esbuild-jest": "^0.4.0",
7073
"eslint": "^7.0.0",
7174
"eslint-config-prettier": "^6.12.0",

plugins.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { startDevServer } = require('@cypress/vite-dev-server')
2+
3+
module.exports = (on, config) => {
4+
on('dev-server:start', (options) => {
5+
return startDevServer({ options, viteConfig: require('./vite.config') })
6+
})
7+
return config
8+
}

0 commit comments

Comments
 (0)