@@ -17,33 +17,61 @@ export interface SnapshotOptions {
1717 id ?: string ;
1818}
1919
20+ // When an assert fail, the message string will be shown in the error
2021export interface Assertions {
22+ // Assert that actual is deep equal to expected
2123 deepEqual < ValueType = any > ( actual : ValueType , expected : ValueType , message ?: string ) : void ;
24+ // Failing assertion
2225 fail ( message ?: string ) : void ;
26+ // Assert that actual is equal to false
2327 false ( actual : any , message ?: string ) : void ;
28+ // Assert that actual is falsy (false, 0, '', "", null, undefined, NaN)
2429 falsy ( actual : any , message ?: string ) : void ;
30+ // Assert that error is falsy
2531 ifError ( error : any , message ?: string ) : void ;
32+ // Assert that actual is equal to expected (use deepEqual for objects/arrays)
2633 is < ValueType = any > ( actual : ValueType , expected : ValueType , message ?: string ) : void ;
34+ // Assert that actual is not equal to expected (use notDeepEqual for objects/arrays)
2735 not < ValueType = any > ( actual : ValueType , expected : ValueType , message ?: string ) : void ;
36+ // Assert that actual is not deep equal to expected
2837 notDeepEqual < ValueType = any > ( actual : ValueType , expected : ValueType , message ?: string ) : void ;
38+ // Assert that string does not follow the regex pattern
2939 notRegex ( string : string , regex : RegExp , message ?: string ) : void ;
40+ // Assert that a function that never returns does not throw an error
3041 notThrows ( value : ( ) => never , message ?: string ) : void ;
42+ // Assert that a function that returns an observable does not throw an error
3143 notThrows ( value : ( ) => ObservableLike , message ?: string ) : Promise < void > ;
44+ // Assert that a function that returns a promise does not throw an error
3245 notThrows ( value : ( ) => PromiseLike < any > , message ?: string ) : Promise < void > ;
46+ // Assert that a function that returns any value does not throw an error
3347 notThrows ( value : ( ) => any , message ?: string ) : void ;
48+ // Assert that an observable does not throw an error
3449 notThrows ( value : ObservableLike , message ?: string ) : Promise < void > ;
50+ // Assert that a promise does not throw an error
3551 notThrows ( value : PromiseLike < any > , message ?: string ) : Promise < void > ;
52+ // Passing assertion
3653 pass ( message ?: string ) : void ;
54+ // Assert that string follows the regex pattern
3755 regex ( string : string , regex : RegExp , message ?: string ) : void ;
56+ // Assert that expected matches a snapshot
3857 snapshot ( expected : any , message ?: string ) : void ;
58+ // Assert that expected matches a snapshot with option `id`
3959 snapshot ( expected : any , options : SnapshotOptions , message ?: string ) : void ;
60+ // Assert that a function that never returns throws an error
4061 throws ( value : ( ) => never , error ?: ThrowsErrorValidator , message ?: string ) : any ;
62+ // Assert that a function that returns an observable throws an error
4163 throws ( value : ( ) => ObservableLike , error ?: ThrowsErrorValidator , message ?: string ) : Promise < any > ;
64+ // Assert that a function that returns a promise throws an error
4265 throws ( value : ( ) => PromiseLike < any > , error ?: ThrowsErrorValidator , message ?: string ) : Promise < any > ;
66+ // Assert that a function that returns any value throws an error
4367 throws ( value : ( ) => any , error ?: ThrowsErrorValidator , message ?: string ) : any ;
68+ // Assert that an observable throws an error
4469 throws ( value : ObservableLike , error ?: ThrowsErrorValidator , message ?: string ) : Promise < any > ;
70+ // Assert that a promise throws an error
4571 throws ( value : PromiseLike < any > , error ?: ThrowsErrorValidator , message ?: string ) : Promise < any > ;
72+ // Assert that actual is equal to true
4673 true ( actual : any , message ?: string ) : void ;
74+ // Assert that actual is truthy ('0', 'false', [], {}, function() {}, etc.)
4775 truthy ( actual : any , message ?: string ) : void ;
4876}
4977
@@ -78,15 +106,25 @@ export interface TestInterface<Context = {}> {
78106 ( title : string , macro : Macro < Context > | Macro < Context > [ ] , ...args : Array < any > ) : void ;
79107 ( macro : Macro < Context > | Macro < Context > [ ] , ...args : Array < any > ) : void ;
80108
109+ // Test hook that runs after all tests are done
81110 after : AfterInterface < Context > ;
111+ // Test hook that runs after each test is done
82112 afterEach : AfterInterface < Context > ;
113+ // Test hook that runs before all test starts
83114 before : BeforeInterface < Context > ;
115+ // Test hook that runs before each test starts
84116 beforeEach : BeforeInterface < Context > ;
117+ // Test modifier that enables callback support
85118 cb : CbInterface < Context > ;
119+ // Test modifier to forcely fails a test
86120 failing : FailingInterface < Context > ;
121+ // Test modifier to run this test only
87122 only : OnlyInterface < Context > ;
123+ // Test modifier to run test with serial tag first serially
88124 serial : SerialInterface < Context > ;
125+ // Test modifier to skip tagged tests
89126 skip : SkipInterface < Context > ;
127+ // Test modifier for todo tests
90128 todo : TodoDeclaration ;
91129}
92130
0 commit comments