TestRun

interface TestRun(source)

A TestRun represents an in-progress or completed test run and provides methods to report the state of individual tests in the run.

Online Documentation

Properties

Link copied to clipboard
abstract val isPersisted: Boolean

Whether the test run will be persisted across reloads by the editor.

Link copied to clipboard
abstract val name: String?

The human-readable name of the run. This can be used to disambiguate multiple sets of results in a test run. It is useful if tests are run across multiple platforms, for example.

Link copied to clipboard
abstract var onDidDispose: Event<Void>

An event fired when the editor is no longer interested in data associated with the test run.

Link copied to clipboard
abstract val token: CancellationToken

A cancellation token which will be triggered when the test run is canceled from the UI.

Functions

Link copied to clipboard
abstract fun addCoverage(fileCoverage: FileCoverage)

Adds coverage for a file in the run.

Link copied to clipboard
abstract fun appendOutput(output: String, location: Location = definedExternally, test: TestItem = definedExternally)

Appends raw output from the test runner. On the user's request, the output will be displayed in a terminal. ANSI escape sequences, such as colors and text styles, are supported. New lines must be given as CRLF (\r\n) rather than LF (\n).

Link copied to clipboard
abstract fun end()

Signals the end of the test run. Any tests included in the run whose states have not been updated will have their state reset.

Link copied to clipboard
abstract fun enqueued(test: TestItem)

Indicates a test is queued for later execution.

Link copied to clipboard
abstract fun errored(test: TestItem, message: JsAny, duration: Int = definedExternally)

Indicates a test has errored. You should pass one or more TestMessages to describe the failure. This differs from the "failed" state in that it indicates a test that couldn't be executed at all, from a compilation error for example.

Link copied to clipboard
abstract fun failed(test: TestItem, message: JsAny, duration: Int = definedExternally)

Indicates a test has failed. You should pass one or more TestMessages to describe the failure.

Link copied to clipboard
abstract fun passed(test: TestItem, duration: Int = definedExternally)

Indicates a test has passed.

Link copied to clipboard
abstract fun skipped(test: TestItem)

Indicates a test has been skipped.

Link copied to clipboard
abstract fun started(test: TestItem)

Indicates a test has started running.