@onzag/itemize / Modules / testing / Test
testing.Test
Defines a test, and it should be used as an entry for all subtests
-
Test↳
RQTest
- after
- before
- construtor
- define
- describe
- execute
- executeIts
- info
- it
- quit
- skipAll
- skipLayer
- skipNext
- step
- wait
- warn
• new Test(): Test
• Private currentStep: "it" | "after" | "before" | "describe" = null
• Private describeQueue: { label: string ; test: Test }[]
This queue contains the description of subtests that are added to the test
• Private doSkipAll: boolean = false
Specifies that all subsequent step from the itQueue should be cancelled
• Private doSkipLayer: boolean = false
• Private doSkipNext: boolean = false
Specifies that the next step from the itQueue should be cancelled
• Private doStop: boolean = false
• Private itQueue: ItHandle[]
This queue contains in order all the it definitions as well as steps to execute during the test
• 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
▸ after(): any
Executes after everything is done use for cleanup
any
▸ before(): any
Executes before, override this function it allows you to dinamically add tests as well
any
▸ construtor(): void
Build a brand new instance
void
▸ define(label, test?): void
Define a new test
| Name | Type | Default value | Description |
|---|---|---|---|
label |
string |
undefined |
the label for the test |
test |
Test |
null |
the test instance |
void
▸ describe(): any
Executes during just after before has been executed
any
▸ execute(level?): Promise<{ passed: number ; total: number ; warnings: number }>
Executes the test
| Name | Type | Default value |
|---|---|---|
level |
number |
0 |
Promise<{ passed: number ; total: number ; warnings: number }>
▸ executeIts(level): Promise<{ passed: number ; total: number ; warnings: number }>
Executes all the it available from the it queue
| Name | Type | Description |
|---|---|---|
level |
number |
basically the number of tabs to use |
Promise<{ passed: number ; total: number ; warnings: number }>
▸ info(txt): WarnHandle
Provides information during the test
| Name | Type |
|---|---|
txt |
string |
WarnHandle
▸ it(label, fn?): ItHandle
Define a new assertion
| Name | Type | Default value | Description |
|---|---|---|---|
label |
string |
undefined |
the label for the assertion |
fn |
() => void | PromiseLike<void> |
null |
the assetion to execute |
ItHandle
▸ quit(): void
Quits this test
void
▸ skipAll(): void
Skips all the following IT tests regardless of layer
void
▸ 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
void
▸ 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
void
▸ 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
| Name | Type | Default value |
|---|---|---|
fn |
() => void | PromiseLike<void> |
null |
ItHandle
▸ wait(ms): Promise<void>
Helper function to wait
| Name | Type |
|---|---|
ms |
number |
Promise<void>
▸ warn(txt): WarnHandle
Warns during the test
| Name | Type |
|---|---|
txt |
string |
WarnHandle