From 6048dfc57bfcc4de6e0862e6fe3c8eaf36bc635f Mon Sep 17 00:00:00 2001 From: WillieHabi <143546745+WillieHabi@users.noreply.github.com> Date: Thu, 6 Jun 2024 10:41:00 -0400 Subject: [PATCH] Updated Debugging (markdown) --- Debugging.md | 9 +++++++++ 1 file changed, 9 insertions(+) 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' +``` + +