Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

How to Debug Mocha JS Tests

Hemika Kodikara edited this page Aug 18, 2017 · 1 revision

Note: This only works with chrome.

Execute the following command to execute a test :

NODE_ENV=test node --inspect ./node_modules/mocha-webpack/lib/cli --require ./js/tests/js/spec/setup.js --webpack-config ./webpack.config.js ./js/tests/js/spec/BallerinaTest.js --timeout 600000;

As soon as you run it, a similar url will be printed on the log.

chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:9229/0f95846c-9239-4b85-a51c-92e6be469991

Go to the url in chrome and put the breakpoint. This url is NOT static.

Do the debugging and close the browser tab to finish the test execution.

To debug all tests, execute:

npm run test-debug

Happy Debugging.

Sample sidebar

Clone this wiki locally