vite-test
raw JSON → 0.4.0 verified Mon Apr 27 auth: no javascript
vite-test (v0.4.0) lets you test Vue apps in real browsers using Vite and Puppeteer. It uses the zora test runner with TAP output, provides quick execution in a native browser environment compared to jsdom-based jest. Release cadence is irregular; last release v0.4.0 (zora & TAP ftw). Key differentiators: leverages Vite's dev server for fast HMR during debugging, supports both headless CI (Puppeteer) and browser debug mode.
Common errors
error Error: Cannot find module 'zora' ↓
cause zora not installed
fix
npm install zora --save-dev
error Error: Cannot find module '@vue/test-utils' ↓
cause @vue/test-utils not installed
fix
npm install @vue/test-utils@^2.0.0 --save-dev
error Error: Failed to launch the browser process! puppeteer ↓
cause Puppeteer not installed or missing browser binaries
fix
npm install puppeteer or set PUPPETEER_SKIP_DOWNLOAD=0
error Error [ERR_MODULE_NOT_FOUND]: Cannot find module ↓
cause Import path issues or lack of ESM support
fix
Use .js extension in imports, or ensure package.json has 'type': 'module'
Warnings
breaking v0.3.0 requires Vite v2; older v0.2.x may not work with Vite v2+ ↓
fix Update vite-test to >=0.3.0 and ensure Vite is v2+
deprecated v0.4.0 uses zora test runner (TAP), not the previous test runner. Scripts using non-TAP output will break ↓
fix Use TAP reporters like tap-dot or pipe to tap-spec
gotcha Must have @vue/test-utils v2+ installed separately; vite-test does not install it automatically ↓
fix Run: npm install @vue/test-utils@^2.0.0
gotcha Puppeteer is required for terminal/CI runs; if missing, tests fail silently ↓
fix Run: npm install puppeteer
gotcha vite-test does not provide a test function; you must import 'test' from zora ↓
fix Add 'zora' as a dependency and import { test } from 'zora'
Install
npm install vite-test yarn add vite-test pnpm add vite-test Imports
- vite-test wrong
import viteTest from 'vite-test'correctvite-test is a CLI tool; no import needed — run via `npx vite-test` - test wrong
import { test } from 'vite-test'correctimport { test } from 'zora' - mount wrong
const { mount } = require('@vue/test-utils')correctimport { mount } from '@vue/test-utils'
Quickstart
// package.json
{
"scripts": {
"test": "vite-test | tap-dot",
"test:debug": "vite-test --debug"
},
"devDependencies": {
"vite-test": "^0.4.0",
"tap-dot": "^2.0.0",
"zora": "^4.0.0"
}
}
// test/my-test.test.js
import { test } from 'zora'
import { mount } from '@vue/test-utils'
import MyComponent from '../src/MyComponent.vue'
test('MyComponent renders', async t => {
const wrapper = mount(MyComponent)
t.ok(wrapper.exists(), 'component exists')
t.eq(wrapper.text(), 'Hello, World!', 'renders correct text')
})