Skip to main content

lastFailed

Overview

Testplane can rerun tests that failed in the last run. To do this, it saves a JSON file with information about the failed tests after each run.

With the lastFailed section, you can configure the location of this file and other options.

To run only the failed tests from the CLI, use the --last-failed-only option or the environment variable testplane_last_failed_only=true.

Setup

The lastFailed section has the following format:

testplane.config.ts
import type { ConfigInput } from "testplane";

export default {
// ...
lastFailed: {
only: false,
input: [".testplane/failed.json"],
output: ".testplane/failed.json",
},
} satisfies ConfigInput;

Configuration Parameter Descriptions

ParameterTypeDefaultDescription
onlybooleanfalseEnable / disable the rerun mode for failed tests.
inputstring | string[]".testplane/failed.json"Path or list of paths to read the list of failed tests.
outputstring".testplane/failed.json"Path to save the list of failed tests.

only

Enables the rerun mode for failed tests. In this mode, only tests from the list specified in input are run if set to true.

Default: false.

input

Path or list of paths to read the list of failed tests. If a list of file paths is specified, all tests that appear in at least one of them are rerun.

Default: .testplane/failed.json.

output

Path to save the list of failed tests. Always used, regardless of the only option.

Default: .testplane/failed.json.