From 15009fb8c2734da85d6a1a93b39c8739415f1f59 Mon Sep 17 00:00:00 2001 From: Alfred Dagenais Date: Sun, 11 Oct 2020 13:11:12 -0400 Subject: [PATCH 1/2] ADD: Ajustements from last Mocha version --- debugging-mocha-tests/.vscode/launch.json | 2 +- debugging-mocha-tests/README.md | 21 ++++++++++++--------- debugging-mocha-tests/package.json | 7 +++++-- debugging-mocha-tests/support/mocha.json | 4 ++++ debugging-mocha-tests/support/mocha.opts | 2 -- 5 files changed, 22 insertions(+), 14 deletions(-) create mode 100644 debugging-mocha-tests/support/mocha.json delete mode 100644 debugging-mocha-tests/support/mocha.opts 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..390965f 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: 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 From 4851168b941646343272304be69aab7c7ce1bb54 Mon Sep 17 00:00:00 2001 From: Alfred Dagenais Date: Sun, 11 Oct 2020 13:18:03 -0400 Subject: [PATCH 2/2] ADD: Tips informations for help --- debugging-mocha-tests/README.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/debugging-mocha-tests/README.md b/debugging-mocha-tests/README.md index 390965f..41a0b9a 100644 --- a/debugging-mocha-tests/README.md +++ b/debugging-mocha-tests/README.md @@ -167,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 +} +```