The debugger starts where the failure is. Debug this test on the Tests page launches the failing JavaScript or
TypeScript test with a breakpoint on the line that failed; in the source editor, F9 and F5 do the same for any
JavaScript, TypeScript or Python file in the project. The debugger runs the file on disk, so save edits before launch.
Launch
| From | Target |
|---|---|
| Workspace toolbar Debug file | The file in the editor. |
| Toolbar Open debugger, project menu Open debugger, palette Debug project source | The target picker. |
Debug this test (d) on the project Tests page | The selected test, in test mode, with a breakpoint at its failure line. |
An elide://debug link | The linked file. |
The source editor’s Debug overlay, F5 | The file in the editor. |
The target picker lists the project’s files in groups: Debugged this session, Recently tested, Tests,
Entry points and Sources. / opens it, typing filters, Enter launches. A JavaScript or TypeScript test
launches in test mode, through the test runner; a Python test file runs as a script.
Breakpoints
| Where | How |
|---|---|
| Breakpoints tab | Enter file:line (for example src/main.mjs:12) and choose Add breakpoint, before launch or while stopped. |
| While stopped | b adds a breakpoint at the selected frame’s line. |
| Source editor | F9 toggles a breakpoint on the caret line. |
A breakpoint the debugger has not verified shows the adapter’s message. A session holds up to 256 breakpoints.
Step and inspect
The page has three tabs: Inspect (stack and scopes), Breakpoints and Output; Tab and Shift+Tab
move between them. The head shows why the target stopped: Paused at entry, Breakpoint reached, Step complete,
Paused or Exception.
| Key | Action |
|---|---|
F5 | Continue. |
F6 | Pause a running target. |
⇧F5 | Stop the target. |
F10 | Step over. |
F11 | Step into. |
⇧F11 | Step out. |
j k, ↑ ↓ | Select a frame (Inspect). |
b | Breakpoint at the selected frame’s line. |
Esc, Backspace | Back out of an opened value (Inspect). Esc also dismisses an error, and quits when nothing is open. |
q, Ctrl+D | Quit. |
Values are read only when you ask: Inspect values reads a scope’s values, and selecting a value with children opens it. Reading a value can run guest getters. Values clear when the target resumes. Source links open a frame’s file at its line.
Source editor
In the source editor, the Debug overlay marks breakpoints and the paused line in
the gutter and tints their rows. Before launch it shows Launch (F5); run and step controls appear while a target
exists.
| Key | Action |
|---|---|
F9 | Toggle a breakpoint on the caret line. |
F5 | Launch, or resume when paused. |
F6 | Pause. |
⇧F5 | Stop. |
F10, F11, ⇧F11 | Step over, into, out. |
F7 | Move the caret back to the paused line. |
Breakpoints follow their lines as you edit.
Shared control
The debugger runs in the project session, so other debugger views, the source editor and Tern’s agent see the same target. One view controls execution; the others observe.
| Action | Effect |
|---|---|
| Take control | Moves control to this view and drops the previous owner’s queued commands. |
| Closing the controlling view | Another view has 30 seconds to take control; then the target stops. |
| Stop | Ends the target at once. |
A debug-test run cannot overlap an ordinary test run writing to the same project reports.
Other debuggers
To debug outside Tern, or to debug Java and Kotlin, attach a CDP, DAP or JDWP client: see Debugging.
Next
The test passes. Coverage shows which lines it reached and which it did not.