mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-30 17:37:14 +00:00
106141f74c
* feat: jest-puppeteer example * - Refactor test * - lint * - lint * - eslint-disable no-undef
40 lines
666 B
Markdown
Executable File
40 lines
666 B
Markdown
Executable File
# Example how to test Nuxt.js app with Jest and Puppeteer
|
|
|
|
# Install deps
|
|
```
|
|
npm install
|
|
```
|
|
|
|
# Run tests
|
|
```
|
|
npm run test
|
|
```
|
|
|
|
## It will
|
|
- Build app
|
|
- Run server
|
|
- Run tests
|
|
|
|
### Output
|
|
```
|
|
PASS test/index.spec.js
|
|
Index page
|
|
√ test index title (53ms)
|
|
√ test navigate to about page (2ms)
|
|
|
|
Test Suites: 1 passed, 1 total
|
|
Tests: 2 passed, 2 total
|
|
Snapshots: 2 passed, 2 total
|
|
Time: 0.992s, estimated 1s
|
|
Ran all test suites.
|
|
```
|
|
|
|
## Check configuration files:
|
|
- `jest.config.js`
|
|
- `jest-puppeteer.config.js`
|
|
|
|
## Documentation
|
|
- [jest-puppeteer](https://github.com/smooth-code/jest-puppeteer)
|
|
- [jest]()
|
|
- [puppeteer](https://pptr.dev/)
|