Skip to content

Latest commit

 

History

History
493 lines (277 loc) · 8.9 KB

File metadata and controls

493 lines (277 loc) · 8.9 KB

@onzag/itemize / Modules / testing / Test

Class: Test

testing.Test

Defines a test, and it should be used as an entry for all subtests

Hierarchy

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Test(): Test

Returns

Test

Properties

currentStep

Private currentStep: "it" | "after" | "before" | "describe" = null

Defined in

testing/index.ts:93


describeQueue

Private describeQueue: { label: string ; test: Test }[]

This queue contains the description of subtests that are added to the test

Defined in

testing/index.ts:67


doSkipAll

Private doSkipAll: boolean = false

Specifies that all subsequent step from the itQueue should be cancelled

Defined in

testing/index.ts:90


doSkipLayer

Private doSkipLayer: boolean = false

Defined in

testing/index.ts:91


doSkipNext

Private doSkipNext: boolean = false

Specifies that the next step from the itQueue should be cancelled

Defined in

testing/index.ts:84


doStop

Private doStop: boolean = false

Defined in

testing/index.ts:92


itQueue

Private itQueue: ItHandle[]

This queue contains in order all the it definitions as well as steps to execute during the test

Defined in

testing/index.ts:61


warningQueue

Private warningQueue: WarnHandle[]

This queue contains the list of warnings added during the execution of the test, the warnings are reset each time a new step from the itQueue is executed

Defined in

testing/index.ts:78

Methods

after

after(): any

Executes after everything is done use for cleanup

Returns

any

Defined in

testing/index.ts:132


before

before(): any

Executes before, override this function it allows you to dinamically add tests as well

Returns

any

Defined in

testing/index.ts:115


construtor

construtor(): void

Build a brand new instance

Returns

void

Defined in

testing/index.ts:98


define

define(label, test?): void

Define a new test

Parameters

Name Type Default value Description
label string undefined the label for the test
test Test null the test instance

Returns

void

Defined in

testing/index.ts:141


describe

describe(): any

Executes during just after before has been executed

Returns

any

Defined in

testing/index.ts:123


execute

execute(level?): Promise<{ passed: number ; total: number ; warnings: number }>

Executes the test

Parameters

Name Type Default value
level number 0

Returns

Promise<{ passed: number ; total: number ; warnings: number }>

Defined in

testing/index.ts:433


executeIts

executeIts(level): Promise<{ passed: number ; total: number ; warnings: number }>

Executes all the it available from the it queue

Parameters

Name Type Description
level number basically the number of tabs to use

Returns

Promise<{ passed: number ; total: number ; warnings: number }>

Defined in

testing/index.ts:289


info

info(txt): WarnHandle

Provides information during the test

Parameters

Name Type
txt string

Returns

WarnHandle

Defined in

testing/index.ts:211


it

it(label, fn?): ItHandle

Define a new assertion

Parameters

Name Type Default value Description
label string undefined the label for the assertion
fn () => void | PromiseLike<void> null the assetion to execute

Returns

ItHandle

Defined in

testing/index.ts:157


quit

quit(): void

Quits this test

Returns

void

Defined in

testing/index.ts:278


skipAll

skipAll(): void

Skips all the following IT tests regardless of layer

Returns

void

Defined in

testing/index.ts:236


skipLayer

skipLayer(): void

Skip all the tests that are on the same layer only

because .it and .step can be nested inside others, and they count as their own child layer

Returns

void

Defined in

testing/index.ts:253


skipNext

skipNext(): void

Skip all the next IT tests they should be on the same layer it will not skip what's on a deeper layer

Returns

void

Defined in

testing/index.ts:222


step

step(fn?): ItHandle

Defines a new step, works similar to defining an assertion but it has no label and is just a singular hidden step

Parameters

Name Type Default value
fn () => void | PromiseLike<void> null

Returns

ItHandle

Defined in

testing/index.ts:178


wait

wait(ms): Promise<void>

Helper function to wait

Parameters

Name Type
ms number

Returns

Promise<void>

Defined in

testing/index.ts:269


warn

warn(txt): WarnHandle

Warns during the test

Parameters

Name Type
txt string

Returns

WarnHandle

Defined in

testing/index.ts:195