This repository has been archived by the owner on Mar 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 24
/
.mocharc.js
50 lines (48 loc) · 1.64 KB
/
.mocharc.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
/**
* This configuration[1] is used when `mocha` is invoked directly
* from the command line.
*
* Note that this configuration does not affect tests
* when they are executed through `runTests`.
*
* [1] https://mochajs.org/#configuring-mocha-nodejs
*/
module.exports = {
/**
* From `mocha -h`
*
* ```txt
* --require, -r Require module [array] [default: (none)]
* ```
*/
require: [
// We use `ts-node/register`[1] to run our tests without compiling them.
//
// [1] https://typestrong.org/ts-node/docs/recipes/mocha/#mocha-7-and-newer.
'ts-node/register',
// This option is used to provide a drop-in replacement for the `vscode` module.
// When running `mocha` tests without a VS Code Development Extension Host[1],
// the `vscode` module is not available, so we need to provide a test replacement.
//
// See `test/vscode-register.ts` for more details on how this is implemented.
//
// This answer[2]'s 'bonus track' section was used as a inspiration for this method,
// to run code before the tests begin.
//
// [1] https://code.visualstudio.com/api/working-with-extensions/testing-extension
// [2] https://stackoverflow.com/questions/10561598/global-before-and-beforeeach-for-mocha/51152004#51152004
'test/vscode-register.ts',
],
/**
* From `mocha -h`
*
* ```txt
* spec One or more files, directories, or globs to test
* [array] [default: ["test"]]
* ```
*/
spec: [
// These are the same test files covered by the VS Code Host test runner.
'test/**/*.test.ts',
],
};