1 | # @nuxtjs/module-test-utils
|
2 |
|
3 | [![npm version][npm-version-src]][npm-version-href]
|
4 | [![npm downloads][npm-downloads-src]][npm-downloads-href]
|
5 | [![Circle CI][circle-ci-src]][circle-ci-href]
|
6 | [![Codecov][codecov-src]][codecov-href]
|
7 | [![License][license-src]][license-href]
|
8 |
|
9 | > Test utilities for modules Nuxt.js
|
10 |
|
11 | [📖 **Release Notes**](./CHANGELOG.md)
|
12 |
|
13 | ## Setup
|
14 |
|
15 | Add `@nuxtjs/module-test-utils` dependency to your project
|
16 |
|
17 | ```bash
|
18 | yarn add --dev @nuxtjs/module-test-utils # or npm install --save-dev @nuxtjs/module-test-utils
|
19 | ```
|
20 |
|
21 | ## Usage
|
22 |
|
23 | ```js
|
24 | const { setup, loadConfig, get } = require('@nuxtjs/module-test-utils')
|
25 |
|
26 | describe('basic', () => {
|
27 | let nuxt
|
28 |
|
29 | beforeAll(async () => {
|
30 | ({ nuxt } = await setup(loadConfig(__dirname)))
|
31 | }, 60000)
|
32 |
|
33 | afterAll(async () => {
|
34 | await nuxt.close()
|
35 | })
|
36 |
|
37 | test('render', async () => {
|
38 | const html = await get('/')
|
39 | expect(html).toContain('Works!')
|
40 | })
|
41 | })
|
42 | ```
|
43 |
|
44 | ## License
|
45 |
|
46 | [MIT License](./LICENSE)
|
47 |
|
48 | Copyright (c) - Nuxt Community
|
49 |
|
50 |
|
51 | [npm-version-src]: https://img.shields.io/npm/v/@nuxtjs/module-test-utils/latest.svg?style=flat-square
|
52 | [npm-version-href]: https://npmjs.com/package/@nuxtjs/module-test-utils
|
53 |
|
54 | [npm-downloads-src]: https://img.shields.io/npm/dt/@nuxtjs/module-test-utils.svg?style=flat-square
|
55 | [npm-downloads-href]: https://npmjs.com/package/@nuxtjs/module-test-utils
|
56 |
|
57 | [circle-ci-src]: https://img.shields.io/circleci/project/github/nuxt-community/module-test-utils.svg?style=flat-square
|
58 | [circle-ci-href]: https://circleci.com/gh/nuxt-community/module-test-utils
|
59 |
|
60 | [codecov-src]: https://img.shields.io/codecov/c/github/nuxt-community/module-test-utils.svg?style=flat-square
|
61 | [codecov-href]: https://codecov.io/gh/nuxt-community/module-test-utils
|
62 |
|
63 | [license-src]: https://img.shields.io/npm/l/@nuxtjs/module-test-utils.svg?style=flat-square
|
64 | [license-href]: https://npmjs.com/package/@nuxtjs/module-test-utils
|