diff --git a/Debugging.md b/Debugging.md index 20f6863..1b1ff7d 100644 --- a/Debugging.md +++ b/Debugging.md @@ -101,3 +101,12 @@ To further filter and only run a specified test, you can open the `.vscode/launc ``` *Note the `--no-timeouts` flag. If you do something that will cause a test to hang forever (like changing the driver to tinylicious without actually running the tinylicious server) it'll seem like the debugger isn't working* + +### Break on failing assertions +When debugging your tests, you may want to break on all the failing asserts so you can inspect what is going wrong. To do this in VS Code, you can turn on "Caught Exceptions" and "Uncaught Exceptions" breakpoints and swap out the default nodejs assertion library with the [Chai assertion library](https://www.npmjs.com/package/chai). This can be done simply by installing Chai in the desired package using `pnpm install chai` and then replacing the nodejs assertion library with the Chai assertion library in the test file you want to debug: +```typescript +// import { strict as assert } from "assert" +import { assert } from 'chai' +``` + +