Options
All
  • Public
  • Public/Protected
  • All
Menu

This class represents the configuration properties of the Test class. It is serializable and can be transferred over the network. Some of the properties of this class are also "options" - can be specified in the command-line when launching the test suite.

Hierarchy

  • TestDescriptorPre
    • TestDescriptor

Index

Constructors

constructor

  • Parameters

    • Rest ...input: any[]

    Returns TestDescriptor

Properties

defaultTimeout

defaultTimeout: number

A default timeout for various asynchronous actions, in milliseconds.

Default value is 15000ms.

isTodo

isTodo: boolean

Whether this test is "todo" or not. Todo tests are considered work in progress and expected to fail. The failed assertions in them are not reported. In opposite, the passed assertions from the todo tests are reported.

snooze

snooze: string | Date

Either a Date instance or a string, recognized by the Date constructor.

If this config is specified, and the test is running prior the specified date, the test will be switched to todo mode.

For example in the project file:

project.plan(
{
filename : 'some_test.t.js',
// choose the unsnooze date wisely
snooze : '2021-12-25'
}
)

in the test file:

it({
title : 'Some test',
snooze : '2022-01-01'
}, async t => {
...
})

title

title: string = ''

The human-readable title of this test.

url

url: string = ''

The url for this test, relative to the parent descriptor. It can also be an absolute url. By convention, Siesta tests should have *.t.js extension.

For the top-level descriptors, url is relative to the project file itself.

For example:

project.plan(
{
// relative to project file
url : 'some_directory',

items : [
// relative to `some_directory`
{ url : 'test_1.t.js' }
// or just:
'test_2.t.js',
]
}
)

waitForPollInterval

waitForPollInterval: number

A default poll interval for the waitFor assertion, in milliseconds.

Default value is 50ms.

waitForTimeout

waitForTimeout: number

A default timeout for the waitFor assertion, in milliseconds. If not provided, the defaultTimeout will be used.

Methods

initialize

Static maybeNew

  • maybeNew<T>(props?: InstanceType<T> | Partial<InstanceType<T>>): InstanceType<T>
  • This is a type-safe static constructor method, accepting a single argument. If that argument is already an instance of this class - it is returned right away, otherwise the new constructor is used for instantiation.

    Type parameters

    Parameters

    • Optional props: InstanceType<T> | Partial<InstanceType<T>>

    Returns InstanceType<T>

Static new

  • new<T>(props?: Partial<InstanceType<T>>): InstanceType<T>
  • This is a type-safe static constructor method, accepting a single argument, with the object, corresponding to the class properties. It will generate a compilation error, if unknown property is provided.

    For example:

    class MyClass extends Base {
    prop : string
    }

    const instance : MyClass = MyClass.new({ prop : 'prop', wrong : 11 })

    will produce:

    TS2345: Argument of type '{ prop: string; wrong: number; }' is not assignable to parameter of type 'Partial<MyClass>'.
    Object literal may only specify known properties, and 'wrong' does not exist in type 'Partial<MyClass>'

    The only thing this constructor does is create an instance and call the initialize method on it, forwarding the first argument. The customization of instance is supposed to be performed in that method.

    Type parameters

    Parameters

    • Optional props: Partial<InstanceType<T>>

    Returns InstanceType<T>

Generated using TypeDoc