- TestContext
The test context, available as
thiswithin each test function.
- test-object-model
- Tom ⏏
- new Tom([name], [testFn], [options])
- instance
- .name :
string - .testFn :
function - .index :
number - .ended :
boolean - .result :
* - .disabledByOnly :
boolean - .options
- .context :
TextContext - .state :
string - .type ⇒
string - .toSkip ⇒
booolean - .stats :
object - .toString() ⇒
string - .group(name, options) ⇒
Tom - .test(name, testFn, options) ⇒
Tom - .skip() ⇒
Tom - .only() ⇒
Tom - .before() ⇒
Tom - .todo() ⇒
Tom - .after() ⇒
Tom - .run() ⇒
Promise - .reset()
- .getTestCount()
- "todo" (test)
- "skipped" (test)
- "ignored" (test)
- "in-progress" (test)
- "pass" (test, result)
- "fail" (test, err)
- .name :
- static
- .combine(tests, [name]) ⇒
Tom - .validate(tom) ⇒
boolean
- .combine(tests, [name]) ⇒
- inner
- Tom ⏏
| Param | Type | Description |
|---|---|---|
| [name] | string |
The test name. |
| [testFn] | function |
A function which will either succeed, reject or throw. |
| [options] | object |
Test config. |
| [options.timeout] | number |
A time limit for the test in ms. |
| [options.maxConcurrency] | number |
The max concurrency that child tests will be able to run. For example, specifying 2 will allow child tests to run two at a time. Defaults to 10. |
| [options.skip] | boolean |
Skip this test. |
| [options.only] | boolean |
Only run this test. |
| [options.before] | boolean |
Run this test before its siblings. |
| [options.after] | boolean |
Run this test after its siblings. |
| [options.todo] | boolean |
Mark this test as incomplete. |
| [options.group] | boolean |
Mark this test as a group. |
Test name
Kind: instance property of Tom
A function which will either succeed, reject or throw.
Kind: instance property of Tom
Position of this test within its parents children
Kind: instance property of Tom
True if the test has ended.
Kind: instance property of Tom
If the test passed, the value returned by the test function. If it failed, the exception thrown or rejection reason.
Kind: instance property of Tom
True if one or more different tests are marked as only.
Kind: instance property of Tom
The options set when creating the test.
Kind: instance property of Tom
The text execution context.
Kind: instance property of Tom
Test state. Can be one of pending, in-progress, skipped, ignored, todo, pass or fail.
Kind: instance property of Tom
Returns test, group or todo.
Kind: instance property of Tom
Returns true if this test was marked to be skipped by usage of skip or only.
Kind: instance property of Tom
Test execution stats
Kind: instance namespace of Tom
Returns the test name.
Kind: instance method of Tom
tom.group(name, options) ⇒ Tom
Add a test group.
Kind: instance method of Tom
| Param | Type | Description |
|---|---|---|
| name | string |
Test name. |
| options | objects |
Config. |
tom.test(name, testFn, options) ⇒ Tom
Add a test.
Kind: instance method of Tom
| Param | Type | Description |
|---|---|---|
| name | string |
Test name. |
| testFn | function |
Test function. |
| options | objects |
Config. |
tom.skip() ⇒ Tom
Add a skipped test
Kind: instance method of Tom
tom.only() ⇒ Tom
Add an only test
Kind: instance method of Tom
tom.before() ⇒ Tom
Add a test which must run and complete before the others.
Kind: instance method of Tom
tom.todo() ⇒ Tom
Add a test but don't run it and mark as incomplete.
Kind: instance method of Tom
tom.after() ⇒ Tom
Add a test which must run and complete after the others.
Kind: instance method of Tom
Execute the stored test function. Return a promise that either resolves with the value returned by the test function or rejects.
Kind: instance method of Tom
Fulfil: *
Reset state
Kind: instance method of Tom
Used in the @test-runner/core stats.
Kind: instance method of Tom
Test todo.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
Test skipped.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
Test ignored.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
Test in-progress.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
Test pass.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
| result | * |
The value returned by the test. |
Test fail.
Kind: event emitted by Tom
| Param | Type | Description |
|---|---|---|
| test | TestObjectModel |
The test node. |
| err | Error |
The exception thrown. |
If more than one TOM instances are supplied, combine them into a common root.
Kind: static method of Tom
| Param | Type |
|---|---|
| tests | Array.<Tom> |
| [name] | string |
Returns true if the input is a valid test.
Kind: static method of Tom
| Param | Type | Description |
|---|---|---|
| tom | test-object-model |
Input to test. |
Start time.
Kind: inner property of Tom
End time.
Kind: inner property of Tom
Test execution duration.
Kind: inner property of Tom
The test context, available as this within each test function.
Kind: global class
The name given to this test.
Kind: instance property of TestContext
The test index within the current set.
Kind: instance property of TestContext
Test run data.
Kind: instance property of TestContext