# @vue/cli-plugin-unit-mocha

> mocha unit testing plugin for vue-cli

Latest version **5.0.9** (published 2025-08-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install @vue/cli-plugin-unit-mocha
pnpm add @vue/cli-plugin-unit-mocha
yarn add @vue/cli-plugin-unit-mocha
bun add @vue/cli-plugin-unit-mocha
```

## Health

**Score 30/100 (F)** — status: maintenance-mode.

Positive: no vulnerabilities; popular repo.

Warnings: low downloads; no types; no esm support.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 5.0.9 |
| Published | 2025-08-21 |
| First published | 2018-01-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 5 |
| Unpacked size | 11.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29495 |
| Author | Evan You |
| Maintainers | akryum, yyx990803, soda |
| Keywords | vue, vue-cli, mocha, webpack, unit-testing |

## Links

- npm: https://www.npmjs.com/package/@vue/cli-plugin-unit-mocha
- Repository: https://github.com/vuejs/vue-cli
- Homepage: https://github.com/vuejs/vue-cli/tree/dev/packages/@vue/cli-plugin-unit-mocha#readme
- Issues: https://github.com/vuejs/vue-cli/issues
- npm.io page: https://npm.io/package/@vue/cli-plugin-unit-mocha

## Dependencies (5)

- [jsdom](https://npm.io/package/jsdom.md) ^18.0.1
- [mocha](https://npm.io/package/mocha.md) ^8.3.0
- [mochapack](https://npm.io/package/mochapack.md) ^2.1.0
- [jsdom-global](https://npm.io/package/jsdom-global.md) ^3.0.2
- [@vue/cli-shared-utils](https://npm.io/package/@vue/cli-shared-utils.md) ^5.0.9

## Alternatives

- [duck](https://npm.io/package/duck.md) — 4.2M weekly downloads
- [ava](https://npm.io/package/ava.md) — 560.2K weekly downloads
- [storybook-addon-module-mock](https://npm.io/package/storybook-addon-module-mock.md) — 71.7K weekly downloads
- [@ethereum-waffle/mock-contract](https://npm.io/package/@ethereum-waffle/mock-contract.md) — 40.0K weekly downloads
- [aws-elasticsearch-connector](https://npm.io/package/aws-elasticsearch-connector.md) — 37.4K weekly downloads

## Recent versions

- 5.0.9 (latest) — 2025-08-21
- 5.0.6 (next) — 2022-06-16
- 5.0.8 — 2022-07-07
- 5.0.7 — 2022-07-05
- 4.5.19 — 2022-06-28
- 4.5.18 — 2022-06-16
- 5.0.5 — 2022-06-16
- 4.5.17 — 2022-03-23
- 5.0.4 — 2022-03-22
- 4.5.16 — 2022-03-15
- 5.0.3 — 2022-03-15
- 5.0.2 — 2022-03-15
- 5.0.1 — 2022-02-17
- 5.0.0 — 2022-02-17
- 5.0.0-rc.3 — 2022-02-10
- … 141 more at https://npm.io/package/@vue/cli-plugin-unit-mocha/versions

## README

# @vue/cli-plugin-unit-mocha

> unit-mocha plugin for vue-cli

## Injected Commands

- **`vue-cli-service test:unit`**

  Run unit tests with [mochapack](https://github.com/sysgears/mochapack) + [chai](http://chaijs.com/).

  **Note the tests are run inside Node.js with browser environment simulated with JSDOM.**

  ```
  Usage: vue-cli-service test:unit [options] [...files]

  Options:

    --watch, -w   run in watch mode
    --grep, -g    only run tests matching <pattern>
    --slow, -s    "slow" test threshold in milliseconds
    --timeout, -t timeout threshold in milliseconds
    --bail, -b    bail after first test failure
    --require, -r require the given module before running tests
    --include     include the given module into test bundle
    --inspect-brk Enable inspector to debug the tests
  ```

  Default files matches are: any files in `tests/unit` that end in `.spec.(ts|js)`.

  All [mochapack command line options](https://sysgears.github.io/mochapack/docs/installation/cli-usage.html) are also supported.

## Installing in an Already Created Project

```bash
vue add unit-mocha
```

---
_Source: https://npm.io/package/@vue/cli-plugin-unit-mocha · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
