@@ -160,20 +160,16 @@ higher. If you experience errors, please upgrade your version of Node.js.
160
160
161
161
## Testing
162
162
163
- The default testing framework is Mocha, though you can use whatever you want.
164
- Make sure you have it installed:
163
+ The default testing framework is Jest, though you can use whatever you want.
165
164
166
- ```
167
- npm install -g mocha
168
- ```
169
-
170
- Tests should reside in ` test/spec ` in their appropriate folders:
165
+ Tests should reside alongside the modules they are testing:
171
166
172
167
```
173
- ├── test
174
- │ ├── spec
175
- │ │ ├── api
176
- │ │ │ ├── todos.test.js
168
+ ├── server
169
+ │ ├── api
170
+ │ │ ├── todos
171
+ │ │ │ ├── todos.controller.js
172
+ │ │ │ ├── todos.controller.test.js
177
173
```
178
174
179
175
Tests can be written with ES2015, since it passes through ` babel-register ` .
@@ -184,21 +180,19 @@ To run a single test:
184
180
185
181
```
186
182
npm test /path/to/single.test.js
187
- ```
188
183
189
- To run a directory of tests:
190
-
191
- ```
192
- npm test /path/to/test/directory
184
+ // Or, to watch for changes
185
+ npm run test:watch /path/to/single.test.js
193
186
```
194
187
195
188
To run all tests:
196
189
197
190
```
198
191
npm run test:all
199
- ```
200
192
201
- This will run all tests in the ` test/spec ` directory.
193
+ // Or, to watch for changes
194
+ npm run test:all:watch
195
+ ```
202
196
203
197
## Running ESLint
204
198
0 commit comments