-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Hi! I follow the guidelines but am unable to run cypress unit tests on vite + svelte.
I get the error:
In order to use mount or unmount functions please place the spec in component folder
I simply created a new project with:
npm create vite@latest
Then installed cypress to finally get:
package.json
"devDependencies": {
"@cypress/vite-dev-server": "^2.2.2",
"@tsconfig/svelte": "^2.0.1",
"cypress": "^9.6.0",
"cypress-svelte-unit-test": "^3.3.4",
"svelte": "^3.44.0",
"svelte-check": "^2.2.7",
"svelte-preprocess": "^4.9.8",
"tslib": "^2.3.1",
"typescript": "^4.5.4",
"vite": "^2.9.7"
},
"dependencies": {
"svelte-navigator": "^3.1.5"
}
cypress/plugins/index.ts
const path = require('path')
import { startDevServer } from '@cypress/vite-dev-server';
/**
* @type {Cypress.PluginConfig}
*/
export default (on, config) => {
on('dev-server:start', (options) => {
return startDevServer({
options,
viteConfig: {
configFile: path.resolve(__dirname, '..', '..', 'vite.config.js'),
},
})
})
}
cypress.json
{
"projectId": "q8zv52",
"video": false,
"testFiles": "**/*.cy-spec.ts",
"componentFolder": "src"
}
vite.config.js
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()]
})
src/App.cy-spec.ts
import { defineConfig } from 'vite'
import { svelte } from '@sveltejs/vite-plugin-svelte'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [svelte()]
})
Using node 16 on ubuntu 22.04.
Actual behavior
npm run cy:run-ct
- App
renders App with correct heading:
Error: In order to use mount or unmount functions please place the spec in component folder
Thank you!
Metadata
Metadata
Assignees
Labels
No labels