Open pleymor opened 2 years ago
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
Using node 16 on ubuntu 22.04.
npm run cy:run-ct
1) App renders App with correct heading: Error: In order to use mount or unmount functions please place the spec in component folder
Thank you!
Hi! I follow the guidelines but am unable to run cypress unit tests on vite + svelte.
I get the error:
I simply created a new project with:
Then installed cypress to finally get:
package.json
cypress/plugins/index.ts
cypress.json
vite.config.js
src/App.cy-spec.ts
Using node 16 on ubuntu 22.04.
Actual behavior
Thank you!