You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+21-4Lines changed: 21 additions & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -1,25 +1,28 @@
1
-
# mochapack [](https://gitter.im/sysgears/mochapack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm package][npm-badge]][npm][![Build Status Linux][build-badge]][build][![Build Status Windows][build-badge-windows]][build-windows][![codecov][codecov-badge]][codecov][](https://twitter.com/sysgears)
1
+
# mochapack [](https://gitter.im/sysgears/mochapack?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)[![npm package][npm-badge]][npm][![Build Status Linux][build-badge]][build][![Build Status Windows][build-badge-windows]][build-windows][![codecov][codecov-badge]][codecov][](https://twitter.com/sysgears)
2
2
3
3
This project is a fork of [mocha-webpack](https://github.com/zinserjan/mocha-webpack). We have created this fork since there is no visible activity from original author for a long time.
4
4
5
5
> mocha test runner with integrated webpack precompiler
6
6
7
7
mochapack is basically a wrapper around the following command...
8
+
8
9
```bash
9
10
$ webpack test.js output.js && mocha output.js
10
11
```
11
12
12
-
... but in a much more *powerful* & *optimized* way.
13
+
... but in a much more _powerful_ & _optimized_ way.
13
14
14
15

15
16
16
17
mochapack ...
18
+
17
19
- precompiles your test files automatically with webpack before executing tests
18
20
- handles source-maps automatically for you
19
21
- does not write any files to disk
20
22
- understands globs & all other stuff as test entries like mocha
21
23
22
24
Benefits over plain mocha
25
+
23
26
- has nearly the same CLI as mocha
24
27
- you don't rely on hacky solutions to mock all benefits from webpack, like path resolution
25
28
- mochapack provides a much better watch mode than mocha
@@ -37,12 +40,14 @@ If any build errors happens, they will be shown like below
37
40
## Which version works with mochapack?
38
41
39
42
mochapack works with
43
+
40
44
- webpack in versions `4.x.x` - `5.x.x`
41
45
- mocha in versions `5.x.x` - `9.x.x`
42
46
43
47
## Installation
44
48
45
49
Install mochapack via npm install
50
+
46
51
```bash
47
52
$ npm install webpack mocha mochapack --save-dev
48
53
```
@@ -64,9 +69,10 @@ run all tests by glob
64
69
```bash
65
70
mochapack "test/**/*.js"
66
71
```
72
+
67
73
**Note:** You may noticed the quotes around the glob pattern. That's unfortunately necessary as most terminals will resolve globs automatically.
68
74
69
-
run all tests in directory "test" matching the file pattern *.test.js (add `--recursive` to include subdirectories)
75
+
run all tests in directory "test" matching the file pattern \*.test.js (add `--recursive` to include subdirectories)
70
76
71
77
```bash
72
78
mochapack --glob "*.test.js"test
@@ -78,6 +84,17 @@ Watch mode? just add `--watch`
78
84
mochapack --watch test
79
85
```
80
86
87
+
## Contributing
88
+
89
+
This project uses `nari` package manager to have reproducible builds without resorting to lockfiles, it uses `lockTime` field in `package.json` instead.
90
+
91
+
To install `nari` execute:
92
+
`npm i -g nari`
93
+
94
+
And then `nari` to install the project.
95
+
96
+
To run project scripts use `nari script_name`, for example `nari test` to run unit tests.
97
+
81
98
## License
82
99
83
100
This source code is licensed under the [MIT] license.<br/>
0 commit comments