use
viteto test your vue app in real browser and/orpuppeteer
- fast execution, simple setup
- compared to
jestthis setup is a breeze, e.g. no additional config files, no transformations, just ES modules - native environment compared to
jest&js-dom
- in your
viteproject you'll need to install this 3 packages tap-dotis only needed if you use CI and want to get correct exit code
npm install --save-dev vite-test @vue/test-utils@next tap-dotsample package.json scripts:
"scripts": {
"test:debug": "vite-test --debug",
"test": "vite-test | tap-dot"
}vite-test --debugto keep vite server open onhttp://localhost:3000to debug your test in browser dev tools directly, e.g. onhttp://localhost:3000/test.htmlvite-test | tap-dotCI friendly exit code by tap-dot library (npm install tap-dot)
Also see /test directory
vite-test will run your tests in puppeteer
Open http://localhost:3000/test.html when running vite dev server and open your dev tools
- @vue/test-utils – version 2+ which supports Vue 3
- puppeteer to run tests on your CI
- zora test runner