Vite Setup
This guide will walk you through setting up Peeky in your Vite app.
- Install the
@peeky/test
package:
npm i -D @peeky/test
yarn add -D @peeky/test
pnpm add -D @peeky/test
- In your
vite.config.js
, we need to configure Peeky to use a DOM environment to expose browser-like APIs. Peeky will use thetest
option in your Vite config (learn more):
import { defineConfig } from 'vite'
export default defineConfig({
/* ... */
// Peeky config
test: {
// Use the DOM environment for all tests by default
runtimeEnv: 'dom',
},
})
- You can now execute
peeky open
to open the UI orpeeky run
to run all tests:
npx peeky open
npx peeky run
yarn peeky open
yarn peeky run
pnpm exec peeky open
pnpm exec peeky run
- Add some scripts in your
package.json
to make it easier to run tests:
{
"name": "peeky-demo",
"version": "0.1.0",
"scripts": {
"test:open": "peeky open",
"test": "peeky run"
}
}