Vite plugin with mocha and puppeteer
Vite plugin with mocha and puppeteer
Headless test your Vue
, React
and Lit-Element
component
npm install --save-dev vite-plugin-test puppeteer
yarn install
yarn build
yarn --cwd examples/vue test
yarn --cwd examples/lit-element test
yarn --cwd examples/react test
export interface TestPluginOptions {
dir?: string
watch?: boolean
loaders?: {
[ext: string]: Loader
}
}
dir
- [default: 'tests'] directory where the test or spec fileswatch
- [default: false] enable/diable watchloaders
- when you have a .js
test files with jsx
or tsx
code ./examples/react/vite.config.test.ts
)
loaders: {
'.spec.js': 'jsx'
}
vite.config.test.js
fileimport { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import viteTestPlugin from 'vite-plugin-test'
export default defineConfig({
plugins: [
vue(),
viteTestPlugin({
watch: true
})
]
})
vite --config vite.config.test.js