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
+42-9
Original file line number
Diff line number
Diff line change
@@ -10,15 +10,6 @@ This is the Mocha extension for VS Code enabling developers to run and debug tes
10
10
>
11
11
> Please provide feedback and discuss improvements over at https://github.com/CoderLine/mocha-vscode/discussions
12
12
13
-
## Credits
14
-
15
-
This project started as a fork of the `Extension Test Runner` and `Command-line runner for VS Code tests` developed by Microsoft and then was adapted to work with Mocha directly.
16
-
The main credits of this extension go over to the folks at Microsoft (and their contributors) and without them it would have been a lot more effort to ship a Mocha test runner for VS Code.
Please follow the [general Mocha documentation](https://mochajs.org/) to initially set up tests using the command line. Then, [install this extension](https://marketplace.visualstudio.com/items?itemName=mocha.mocha-vscode).
@@ -34,3 +25,45 @@ This extension automatically discovers and works with the `.mocharc.js/cjs/yaml/
34
25
- The `test` and `suite` identifiers the process extracts. Defaults to `["it", "test"]` and `["describe", "suite"]` respectively, covering Mocha's common interfaces.
35
26
36
27
-`mocha-vscode.debugOptions`: options, normally found in the launch.json, to pass when debugging the extension. See [the docs](https://code.visualstudio.com/docs/nodejs/nodejs-debugging#_launch-configuration-attributes) for a complete list of options.
28
+
29
+
## Features
30
+
31
+
### Show, Running and Debugging Tests
32
+
33
+
This plugin integrates with the built-in test explorer and editor of VS Code to show, run and debug tests.
34
+
35
+
The extension detects `.mocharc.<extension>` configuration files in any folder or workspace you open and will use it to discover the tests to be run.
36
+
37
+

38
+
39
+
### TypeScript and ESM integration
40
+
41
+
This extension is designed to work with both TypeScript, JavaScript (CJS/ESM) codebases assuming you already have a working setup with Mocha and TypeScript integrated.
42
+
43
+
To discover tests this extension dynamically translates your TypeScript or ESM code to CommonJS code (via [ESBuild](https://esbuild.github.io/)) and executes it partially to build up the test list. If this execution fails or you are having code which cannot be translated to CommonJS (e.g. top level awaits) this will result in errors.
44
+
45
+
For execution this extension will try to call directly the Mocha executable passing the `.mocharc` and additional arguments to it.
46
+
47
+
## Troubleshooting
48
+
49
+
### Check if Mocha itself works
50
+
51
+
If you face any issues the first step should be to check whether your tests are working with Mocha itself (outside this extension). Use `npx mocha` in your working and test directories to see whether tests are found and executed successfully. In this case you might [reach out to the Mocha folks](https://github.com/mochajs/mocha/blob/master/.github/CONTRIBUTING.md) to ask questions or report bugs.
52
+
53
+
### Check the output window
54
+
55
+
This extension creates a new output log channel where we print whats happening behind the scenes. You can also increase the log level in VS Code via the `Developer: Set Log Level...` command.
56
+
57
+

58
+
59
+

60
+
61
+
62
+
## Credits
63
+
64
+
This project started as a fork of the `Extension Test Runner` and `Command-line runner for VS Code tests` developed by Microsoft and then was adapted to work with Mocha directly.
65
+
The main credits of this extension go over to the folks at Microsoft (and their contributors) and without them it would have been a lot more effort to ship a Mocha test runner for VS Code.
0 commit comments