UNPKG

1.11 kBMarkdownView Raw
1# @vue/cli-plugin-unit-mocha
2
3> unit-mocha plugin for vue-cli
4
5## Injected Commands
6
7- **`vue-cli-service test:unit`**
8
9 Run unit tests with [mochapack](https://github.com/sysgears/mochapack) + [chai](http://chaijs.com/).
10
11 **Note the tests are run inside Node.js with browser environment simulated with JSDOM.**
12
13 ```
14 Usage: vue-cli-service test:unit [options] [...files]
15
16 Options:
17
18 --watch, -w run in watch mode
19 --grep, -g only run tests matching <pattern>
20 --slow, -s "slow" test threshold in milliseconds
21 --timeout, -t timeout threshold in milliseconds
22 --bail, -b bail after first test failure
23 --require, -r require the given module before running tests
24 --include include the given module into test bundle
25 --inspect-brk Enable inspector to debug the tests
26 ```
27
28 Default files matches are: any files in `tests/unit` that end in `.spec.(ts|js)`.
29
30 All [mochapack command line options](https://sysgears.github.io/mochapack/docs/installation/cli-usage.html) are also supported.
31
32## Installing in an Already Created Project
33
34```bash
35vue add unit-mocha
36```