11// Types generated from brittle readme with chatgpt
22
33declare module 'brittle' {
4- interface Assertion {
5- is ( actual : any , expected : any , message ?: string ) : void
6- not ( actual : any , expected : any , message ?: string ) : void
7- alike ( actual : any , expected : any , message ?: string ) : void
8- unlike ( actual : any , expected : any , message ?: string ) : void
9- ok ( value : any , message ?: string ) : void
10- absent ( value : any , message ?: string ) : void
11- pass ( message ?: string ) : void
12- fail ( message ?: string ) : void
13- exception < T > (
4+ interface CoercibleAssertion {
5+ ( actual : any , expected : any , message ?: string ) : void
6+ coercively ( actual : any , expected : any , message ?: string ) : void
7+ }
8+
9+ interface ExceptionAssertion {
10+ < T > (
1411 fn : T | Promise < T > ,
1512 error ?: RegExp | Error ,
1613 message ?: string
1714 ) : Promise < void >
18- exception < T > ( fn : T | Promise < T > , message ?: string ) : Promise < void >
19- 'exception.all' < T > (
15+ < T > ( fn : T | Promise < T > , message ?: string ) : Promise < void >
16+ all < T > ( fn : T | Promise < T > , message ?: string ) : Promise < void >
17+ all < T > (
2018 fn : T | Promise < T > ,
2119 error ?: RegExp | Error ,
2220 message ?: string
2321 ) : Promise < void >
24- 'exception.all' < T > ( fn : T | Promise < T > , message ?: string ) : Promise < void >
22+ }
23+
24+ interface Assertion {
25+ is: CoercibleAssertion
26+ not: CoercibleAssertion
27+ alike: CoercibleAssertion
28+ unlike: CoercibleAssertion
29+ ok ( value : any, message ?: string) : void
30+ absent ( value : any, message ?: string) : void
31+ pass ( message ?: string) : void
32+ fail ( message ?: string) : void
33+ exception : ExceptionAssertion
2534 execution < T > ( fn : T | Promise < T > , message ?: string ) : Promise < number >
26- 'is.coercively' ( actual : any , expected : any , message ?: string ) : void
27- 'not.coercively' ( actual : any , expected : any , message ?: string ) : void
28- 'alike.coercively' ( actual : any , expected : any , message ?: string ) : void
29- 'unlike.coercively' ( actual : any , expected : any , message ?: string ) : void
3035 }
3136
3237 interface TestOptions {
@@ -42,43 +47,40 @@ declare module 'brittle' {
4247 timeout ( ms : number ) : void
4348 comment ( message : string ) : void
4449 end ( ) : void
45- test (
50+ test : TestFn
51+ }
52+
53+ type TestCallback = ( t : TestInstance ) => void | Promise < void >
54+
55+ interface TestFn {
56+ // The brittle docs suggest the return value is `Promise<boolean>` but this is not the case.
57+ (
4658 name : string ,
4759 options : TestOptions ,
4860 callback : ( t : TestInstance ) => void | Promise < void >
49- ) : Promise < boolean >
50- test (
61+ ) : Promise < void >
62+ (
5163 name : string ,
5264 callback : ( t : TestInstance ) => void | Promise < void >
53- ) : Promise < boolean >
54- test ( name : string , options : TestOptions ) : TestInstance
55- test ( options : TestOptions ) : TestInstance
65+ ) : Promise < void >
66+ ( callback : ( t : TestInstance ) => void | Promise < void > ) : Promise < void >
67+ ( name : string , options : TestOptions ) : TestInstance
68+ ( name : string ) : TestInstance
69+ ( ) : TestInstance
70+ // The docs suggest the below is possible, but it isn't
71+ // (options: TestOptions): TestInstance
5672 }
5773
58- type TestCallback = ( t : TestInstance ) => void | Promise < void >
74+ interface Test extends TestFn {
75+ test : Test
76+ solo : TestFn
77+ skip : TestFn
78+ }
5979
60- function test (
61- name : string ,
62- options : TestOptions ,
63- callback : TestCallback
64- ) : Promise < boolean >
65- function test ( name : string , callback : TestCallback ) : Promise < boolean >
66- function test ( name : string , options : TestOptions ) : TestInstance
67- function test ( options : TestOptions ) : TestInstance
68- function solo (
69- name : string ,
70- options : TestOptions ,
71- callback : TestCallback
72- ) : Promise < boolean >
73- function solo ( name : string , callback : TestCallback ) : Promise < boolean >
74- function solo ( options : TestOptions ) : TestInstance
75- function skip (
76- name : string ,
77- options : TestOptions ,
78- callback : TestCallback
79- ) : Promise < boolean >
80- function skip ( name : string , callback : TestCallback ) : void
81- function configure ( options : TestOptions ) : void
80+ export const solo : TestFn
81+ export const skip : TestFn
82+ export const test : Test
83+ export function configure ( options : TestOptions ) : void
8284
83- export { test , solo , skip , configure }
85+ export default test
8486}
0 commit comments