diff --git a/debugging-mocha-tests/.vscode/launch.json b/debugging-mocha-tests/.vscode/launch.json index b068fbc..8676f42 100644 --- a/debugging-mocha-tests/.vscode/launch.json +++ b/debugging-mocha-tests/.vscode/launch.json @@ -1,5 +1,5 @@ { - "version": "0.2.0", + "version": "0.2.1", "configurations": [ { "type": "node", diff --git a/debugging-mocha-tests/README.md b/debugging-mocha-tests/README.md index 36c2025..41a0b9a 100644 --- a/debugging-mocha-tests/README.md +++ b/debugging-mocha-tests/README.md @@ -105,17 +105,18 @@ If you don't have all of your tests under a common "test" directory, then the fo } ``` -If you are running mocha will multiple arguments, you may consider creating an opt file that store all these arguments (i.e name it as mocha.opts). +If you are running mocha will multiple arguments, you may consider creating an opt file that store all these arguments (i.e name it as mocha.json). -Example file contents with mocha arguments: +Example file contents with mocha arguments: -``` ---timeout 999999 ---colors ---full-trace +```json +{ + "colors": true, + "timeout": 999999 +} ``` -Reference the mocha opts file with --opts in configuration as shown below +Reference the mocha config file with --config in configuration as shown below ```json { @@ -127,8 +128,8 @@ Reference the mocha opts file with --opts in configuration as shown below "name": "Mocha Test All with Options", "program": "${workspaceFolder}/node_modules/mocha/bin/_mocha", "args": [ - "--opts", - "${workspaceFolder}/support/mocha.opts", + "--config", + "${workspaceFolder}/support/mocha.json", "${workspaceFolder}/test" ], "console": "integratedTerminal", @@ -141,6 +142,8 @@ Reference the mocha opts file with --opts in configuration as shown below } ``` +Mocha supports [many configuration](https://mochajs.org/#configuring-mocha-nodejs), typical of modern command-line tools. + ## Debugging all tests You can debug all tests by following the steps below: @@ -164,3 +167,16 @@ You can debug the test you're editing by following the steps below: 3. Your breakpoint will now be hit ![current](current.gif) + +## Tips + +If you be warned by `Configured debug type 'pwa-node' is not supported.` in VSCode + +Update the content of the `.vscode/settings.json` with the following configurations: + +```json +{ + "debug.chrome.useV3": true, + "debug.javascript.usePreview": false +} +``` diff --git a/debugging-mocha-tests/package.json b/debugging-mocha-tests/package.json index 90e44e5..4279ffd 100644 --- a/debugging-mocha-tests/package.json +++ b/debugging-mocha-tests/package.json @@ -6,9 +6,12 @@ "test": "mocha 'test/**/*.spec.js'" }, "author": "Jag Reehal", + "contributors": [ + "Alfred Dagenais (https://www.alfreddagenais.com)" + ], "license": "ISC", "dependencies": { - "chai": "4.1.2", - "mocha": "4.1.0" + "chai": "4.2.0", + "mocha": "8.1.3" } } diff --git a/debugging-mocha-tests/support/mocha.json b/debugging-mocha-tests/support/mocha.json new file mode 100644 index 0000000..3f35f93 --- /dev/null +++ b/debugging-mocha-tests/support/mocha.json @@ -0,0 +1,4 @@ +{ + "colors": true, + "timeout": 999999 +} \ No newline at end of file diff --git a/debugging-mocha-tests/support/mocha.opts b/debugging-mocha-tests/support/mocha.opts deleted file mode 100644 index d578ad1..0000000 --- a/debugging-mocha-tests/support/mocha.opts +++ /dev/null @@ -1,2 +0,0 @@ ---timeout 999999 ---colors \ No newline at end of file