Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/zigomir/vite-test
Simple testing with vite
https://github.com/zigomir/vite-test
test-runner vite vite-test vue vue-test-utils vue-test-utils-next vue3
Last synced: 3 months ago
JSON representation
Simple testing with vite
- Host: GitHub
- URL: https://github.com/zigomir/vite-test
- Owner: zigomir
- Created: 2020-11-04T13:11:54.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2023-02-22T02:19:39.000Z (almost 2 years ago)
- Last Synced: 2024-08-08T22:17:07.660Z (5 months ago)
- Topics: test-runner, vite, vite-test, vue, vue-test-utils, vue-test-utils-next, vue3
- Language: JavaScript
- Homepage:
- Size: 192 KB
- Stars: 10
- Watchers: 0
- Forks: 1
- Open Issues: 3
-
Metadata Files:
- Readme: readme.md
Awesome Lists containing this project
README
# vite-test
> use `vite` to test your vue app in real browser and/or `puppeteer`
## benefits
- fast execution, simple setup
- compared to `jest` this setup is a breeze, e.g. no additional config files, no transformations, just ES modules
- native environment compared to `jest` & `js-dom`## usage
- in your `vite` project you'll need to install this 3 packages
- `tap-dot` is only needed if you use CI and want to get correct exit code```sh
npm install --save-dev vite-test @vue/test-utils@next tap-dot
```sample `package.json` scripts:
```json
"scripts": {
"test:debug": "vite-test --debug",
"test": "vite-test | tap-dot"
}
```- `vite-test --debug` to keep vite server open on `http://localhost:3000` to debug your test in browser dev tools directly, e.g. on `http://localhost:3000/test.html`
- `vite-test | tap-dot` CI friendly exit code by tap-dot library (`npm install tap-dot`)Also see `/test` directory
### terminal / CI
`vite-test` will run your tests in `puppeteer`
### browser through vite
Open http://localhost:3000/test.html when running `vite` dev server and open your dev tools
## dependencies
- [@vue/test-utils](https://github.com/vuejs/vue-test-utils-next) – version 2+ which supports Vue 3
- [puppeteer](https://pptr.dev) to run tests on your CI
- [zora test runner](https://github.com/lorenzofox3/zora)