Перейти к содержимому

Эта страница ещё не переведена и показана на английском.

Debugging in Tern

Debug JavaScript, TypeScript and Python sources and JavaScript tests in Tern: launch, breakpoints, stepping, frames and values, and shared control.

Экспериментально

Экспериментально
Эта функция экспериментальная: её команды, параметры и вывод могут меняться между версиями. Сообщить о проблеме

Читать офлайнelide help --lang ru tern-debugging

На этой странице
Использовать с ИИ
Открыть в ChatGPTОткрыть в Claude

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.

TernStep through a program0:13In the Elide source editor, set a breakpoint with F9, launch with F5 and step into a call; the Debug panel shows the call stack and, on request, the values.

Launch

FromTarget
Workspace toolbar Debug fileThe file in the editor.
Toolbar Open debugger, project menu Open debugger, palette Debug project sourceThe target picker.
Debug this test (d) on the project Tests pageThe selected test, in test mode, with a breakpoint at its failure line.
An elide://debug linkThe linked file.
The source editor’s Debug overlay, F5The 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

WhereHow
Breakpoints tabEnter file:line (for example src/main.mjs:12) and choose Add breakpoint, before launch or while stopped.
While stoppedb adds a breakpoint at the selected frame’s line.
Source editorF9 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.

KeyAction
F5Continue.
F6Pause a running target.
⇧F5Stop the target.
F10Step over.
F11Step into.
⇧F11Step out.
j k, ↑ ↓Select a frame (Inspect).
bBreakpoint at the selected frame’s line.
Esc, BackspaceBack out of an opened value (Inspect). Esc also dismisses an error, and quits when nothing is open.
q, Ctrl+DQuit.

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.

KeyAction
F9Toggle a breakpoint on the caret line.
F5Launch, or resume when paused.
F6Pause.
⇧F5Stop.
F10, F11, ⇧F11Step over, into, out.
F7Move 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.

ActionEffect
Take controlMoves control to this view and drops the previous owner’s queued commands.
Closing the controlling viewAnother view has 30 seconds to take control; then the target stops.
StopEnds 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.

Была ли эта страница полезной?