Skip to content

Commit 367d23d

Browse files
committed
Document the new JS APIs.
Also update the pubspec and changelog.
1 parent 6719207 commit 367d23d

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.12.16
2+
3+
* Allow tools to interact with browser debuggers using the JSON reporter.
4+
15
## 0.12.15+12
26

37
* Fix a race condition that could cause the runner to stall for up to three

doc/json_reporter.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -440,3 +440,33 @@ class Metadata {
440440
```
441441

442442
The metadata class is deprecated and should not be used.
443+
444+
## Remote Debugger APIs
445+
446+
When running browser tests with `--pause-after-load`, the test package embeds a
447+
few APIs in the JavaScript context of the host page. These allow tools to
448+
control the debugging process in the same way a user might do from the command
449+
line. They can be accessed by connecting to the remote debugger using the
450+
[`DebugEvent.remoteDebugger`](#DebugEvent) URL.
451+
452+
All APIs are defined as methods on the top-level `dartTest` object. The
453+
following methods are available:
454+
455+
### `resume()`
456+
457+
Calling `resume()` when the test runner is paused causes it to resume running
458+
tests. If the test runner is not paused, it won't do anything. When
459+
`--pause-after-load` is passed, the test runner will pause after loading each
460+
suite but before any tests are run.
461+
462+
This gives external tools a chance to use the remote debugger protocol to set
463+
breakpoints before tests have begun executing. They can start the test runner
464+
with `--pause-after-load`, connect to the remote debugger using the
465+
[`DebugEvent.remoteDebugger`](#DebugEvent) URL, set breakpoints, then call
466+
`dartTest.resume()` in the host frame when they're finished.
467+
468+
### `restartCurrent()`
469+
470+
Calling `restartCurrent()` when the test runner is running a test causes it to
471+
re-run that test once it completes its current run. It's intended to be called
472+
when the browser is paused, as at a breakpoint.

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: test
2-
version: 0.12.16-dev
2+
version: 0.12.16
33
author: Dart Team <[email protected]>
44
description: A library for writing dart unit tests.
55
homepage: https://github.com/dart-lang/test

0 commit comments

Comments
 (0)