W3cubDocs

/Angular

Debugging tests

If your tests aren't working as you expect them to, you can inspect and debug them in the browser.

Debug specs in the browser in the same way that you debug an application.

  1. Reveal the Karma browser window. See Set up testing if you need help with this step.

  2. Click the DEBUG button to open a new browser tab and re-run the tests.

  3. Open the browser's Developer Tools. On Windows, press Ctrl-Shift-I. On macOS, press Command-Option-I.

  4. Pick the Sources section.

  5. Press Control/Command-P, and then start typing the name of your test file to open it.

  6. Set a breakpoint in the test.

  7. Refresh the browser, and notice how it stops at the breakpoint.

Last reviewed on Mon Feb 28 2022

© 2010–2023 Google, Inc.
Licensed under the Creative Commons Attribution License 4.0.
https://angular.io/guide/test-debugging