Skip to content

Commit e33a797

Browse files
authored
docs(mocha-webpack): replace mocha-webpack with mochapack
2 parents 6fdc179 + d9e2663 commit e33a797

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

docs/guides/testing-single-file-components-with-mocha-webpack.md

+7-10
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,17 @@
11
## Testing Single-File Components with Mocha + webpack
22

3-
> An example project for this setup is available on [GitHub](https://github.com/vuejs/vue-test-utils-mocha-webpack-example).
4-
53
Another strategy for testing SFCs is compiling all our tests via webpack and then run it in a test runner. The advantage of this approach is that it gives us full support for all webpack and `vue-loader` features, so we don't have to make compromises in our source code.
64

7-
You can technically use any test runner you like and manually wire things together, but we've found [`mocha-webpack`](https://github.com/zinserjan/mocha-webpack) to provide a very streamlined experience for this particular task.
5+
You can technically use any test runner you like and manually wire things together, but we've found [`mochapack`](https://github.com/sysgears/mochapack) to provide a very streamlined experience for this particular task.
86

9-
### Setting Up `mocha-webpack`
7+
### Setting Up `mochapack`
108

119
We will assume you are starting with a setup that already has webpack, vue-loader and Babel properly configured - e.g. the `webpack-simple` template scaffolded by `vue-cli`.
1210

1311
The first thing to do is installing test dependencies:
1412

1513
```bash
16-
npm install --save-dev @vue/test-utils mocha mocha-webpack
14+
npm install --save-dev @vue/test-utils mocha mochapack
1715
```
1816

1917
Next we need to define a test script in our `package.json`.
@@ -22,7 +20,7 @@ Next we need to define a test script in our `package.json`.
2220
// package.json
2321
{
2422
"scripts": {
25-
"test": "mocha-webpack --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js"
23+
"test": "mochapack --webpack-config webpack.config.js --require test/setup.js test/**/*.spec.js"
2624
}
2725
}
2826
```
@@ -53,7 +51,7 @@ module.exports = {
5351

5452
#### Source Maps
5553

56-
Source maps need to be inlined to be picked up by `mocha-webpack`. The recommended config is:
54+
Source maps need to be inlined to be picked up by `mochapack`. The recommended config is:
5755

5856
```js
5957
module.exports = {
@@ -172,13 +170,12 @@ Woohoo, we got our tests running!
172170

173171
### Coverage
174172

175-
To setup code coverage to `mocha-webpack`, follow [the `mocha-webpack` code coverage guide](https://github.com/zinserjan/mocha-webpack/blob/master/docs/guides/code-coverage.md).
173+
To setup code coverage to `mochapack`, follow [the `mochapack` code coverage guide](https://github.com/sysgears/mochapack/blob/master/docs/guides/code-coverage.md).
176174

177175
### Resources
178176

179-
- [Example project for this setup](https://github.com/vuejs/vue-test-utils-mocha-webpack-example)
180177
- [Mocha](https://mochajs.org/)
181-
- [mocha-webpack](http://zinserjan.github.io/mocha-webpack/)
178+
- [mochapack](https://github.com/sysgears/mochapack/)
182179
- [Chai](http://chaijs.com/)
183180
- [Sinon](http://sinonjs.org/)
184181
- [jest/expect](https://jestjs.io/docs/en/expect#content)

0 commit comments

Comments
 (0)