Skip to content

Commit e6cf13a

Browse files
committed
fix type declarations
1 parent 1c5ebfb commit e6cf13a

1 file changed

Lines changed: 142 additions & 44 deletions

File tree

src/Vitest.res

Lines changed: 142 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,18 @@ type testOptions = {
2525
fails?: bool,
2626
}
2727

28+
type testCollectorOptions = {
29+
timeout?: int,
30+
retry?: int,
31+
repeats?: int,
32+
concurrent?: bool,
33+
sequential?: bool,
34+
skip?: bool,
35+
only?: bool,
36+
todo?: bool,
37+
fails?: bool,
38+
}
39+
2840
type suiteDef = (string, suiteOptions, unit => unit) => unit
2941
type testDef = (string, testOptions, testCtx => unit) => unit
3042
type testAsyncDef = (string, testOptions, testCtx => promise<unit>) => unit
@@ -851,14 +863,92 @@ module Each: EachType = {
851863
}
852864

853865
module type ForType = {
854-
let describe: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => unit) => unit
855-
let describeAsync: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => promise<unit>) => unit
866+
let describe: (
867+
array<'a>,
868+
string,
869+
~timeout: int=?,
870+
~retry: int=?,
871+
~repeats: int=?,
872+
~concurrent: bool=?,
873+
~sequential: bool=?,
874+
~skip: bool=?,
875+
~only: bool=?,
876+
~todo: bool=?,
877+
~fails: bool=?,
878+
('a, testCtx) => unit,
879+
) => unit
880+
let describeAsync: (
881+
array<'a>,
882+
string,
883+
~timeout: int=?,
884+
~retry: int=?,
885+
~repeats: int=?,
886+
~concurrent: bool=?,
887+
~sequential: bool=?,
888+
~skip: bool=?,
889+
~only: bool=?,
890+
~todo: bool=?,
891+
~fails: bool=?,
892+
('a, testCtx) => promise<unit>,
893+
) => unit
856894

857-
let test: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => unit) => unit
858-
let testAsync: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => promise<unit>) => unit
895+
let test: (
896+
array<'a>,
897+
string,
898+
~timeout: int=?,
899+
~retry: int=?,
900+
~repeats: int=?,
901+
~concurrent: bool=?,
902+
~sequential: bool=?,
903+
~skip: bool=?,
904+
~only: bool=?,
905+
~todo: bool=?,
906+
~fails: bool=?,
907+
('a, testCtx) => unit,
908+
) => unit
909+
let testAsync: (
910+
array<'a>,
911+
string,
912+
~timeout: int=?,
913+
~retry: int=?,
914+
~repeats: int=?,
915+
~concurrent: bool=?,
916+
~sequential: bool=?,
917+
~skip: bool=?,
918+
~only: bool=?,
919+
~todo: bool=?,
920+
~fails: bool=?,
921+
('a, testCtx) => promise<unit>,
922+
) => unit
859923

860-
let it: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => unit) => unit
861-
let itAsync: (array<'a>, string, ~timeout: int=?, ('a, testCtx) => promise<unit>) => unit
924+
let it: (
925+
array<'a>,
926+
string,
927+
~timeout: int=?,
928+
~retry: int=?,
929+
~repeats: int=?,
930+
~concurrent: bool=?,
931+
~sequential: bool=?,
932+
~skip: bool=?,
933+
~only: bool=?,
934+
~todo: bool=?,
935+
~fails: bool=?,
936+
('a, testCtx) => unit,
937+
) => unit
938+
let itAsync: (
939+
array<'a>,
940+
string,
941+
~timeout: int=?,
942+
~retry: int=?,
943+
~repeats: int=?,
944+
~concurrent: bool=?,
945+
~sequential: bool=?,
946+
~skip: bool=?,
947+
~only: bool=?,
948+
~todo: bool=?,
949+
~fails: bool=?,
950+
('a, testCtx) => promise<unit>,
951+
) => unit
862952
}
863953

864954
module For: ForType = {
@@ -895,41 +985,47 @@ module For: ForType = {
895985
~options: testCollectorOptions,
896986
~f: @uncurry ('a, testCtx) => promise<unit>,
897987
) => unit = "for"
898-
}
899988

900-
@send
901-
external testObj: (
902-
~test: test,
903-
~cases: array<'a>,
904-
) => (~name: string, ~options: testCollectorOptions, ~f: @uncurry ('a, testCtx) => unit) => unit =
905-
"for"
906-
907-
@send
908-
external testObjAsync: (
909-
~test: test,
910-
~cases: array<'a>,
911-
) => (
912-
~name: string,
913-
~options: testCollectorOptions,
914-
~f: @uncurry ('a, testCtx) => promise<unit>,
915-
) => unit = "for"
916-
917-
@send
918-
external itObj: (
919-
~it: it,
920-
~cases: array<'a>,
921-
) => (~name: string, ~options: testCollectorOptions, ~f: @uncurry ('a, testCtx) => unit) => unit =
922-
"for"
923-
924-
@send
925-
external itObjAsync: (
926-
~it: it,
927-
~cases: array<'a>,
928-
) => (
929-
~name: string,
930-
~options: testCollectorOptions,
931-
~f: @uncurry ('a, testCtx) => promise<unit>,
932-
) => unit = "for"
989+
@send
990+
external testObj: (
991+
~test: test,
992+
~cases: array<'a>,
993+
) => (
994+
~name: string,
995+
~options: testCollectorOptions,
996+
~f: @uncurry ('a, testCtx) => unit,
997+
) => unit = "for"
998+
999+
@send
1000+
external testObjAsync: (
1001+
~test: test,
1002+
~cases: array<'a>,
1003+
) => (
1004+
~name: string,
1005+
~options: testCollectorOptions,
1006+
~f: @uncurry ('a, testCtx) => promise<unit>,
1007+
) => unit = "for"
1008+
1009+
@send
1010+
external itObj: (
1011+
~it: it,
1012+
~cases: array<'a>,
1013+
) => (
1014+
~name: string,
1015+
~options: testCollectorOptions,
1016+
~f: @uncurry ('a, testCtx) => unit,
1017+
) => unit = "for"
1018+
1019+
@send
1020+
external itObjAsync: (
1021+
~it: it,
1022+
~cases: array<'a>,
1023+
) => (
1024+
~name: string,
1025+
~options: testCollectorOptions,
1026+
~f: @uncurry ('a, testCtx) => promise<unit>,
1027+
) => unit = "for"
1028+
}
9331029

9341030
@inline
9351031
let describe = (
@@ -938,7 +1034,6 @@ module For: ForType = {
9381034
~timeout=?,
9391035
~retry=?,
9401036
~repeats=?,
941-
~shuffle=?,
9421037
~concurrent=?,
9431038
~sequential=?,
9441039
~skip=?,
@@ -950,9 +1045,9 @@ module For: ForType = {
9501045
Ext.describeObj(~describe=Ext.describe, ~cases)(
9511046
~name,
9521047
~options={
1048+
?timeout,
9531049
?retry,
9541050
?repeats,
955-
?shuffle,
9561051
?concurrent,
9571052
?sequential,
9581053
?skip,
@@ -970,7 +1065,6 @@ module For: ForType = {
9701065
~timeout=?,
9711066
~retry=?,
9721067
~repeats=?,
973-
~shuffle=?,
9741068
~concurrent=?,
9751069
~sequential=?,
9761070
~skip=?,
@@ -982,9 +1076,9 @@ module For: ForType = {
9821076
Ext.describeObjAsync(~describe=Ext.describe, ~cases)(
9831077
~name,
9841078
~options={
1079+
?timeout,
9851080
?retry,
9861081
?repeats,
987-
?shuffle,
9881082
?concurrent,
9891083
?sequential,
9901084
?skip,
@@ -1013,6 +1107,7 @@ module For: ForType = {
10131107
Ext.testObj(~test=Ext.test, ~cases)(
10141108
~name,
10151109
~options={
1110+
?timeout,
10161111
?retry,
10171112
?repeats,
10181113
?concurrent,
@@ -1043,6 +1138,7 @@ module For: ForType = {
10431138
Ext.testObjAsync(~test=Ext.test, ~cases)(
10441139
~name,
10451140
~options={
1141+
?timeout,
10461142
?retry,
10471143
?repeats,
10481144
?concurrent,
@@ -1073,6 +1169,7 @@ module For: ForType = {
10731169
Ext.itObj(~it=Ext.it, ~cases)(
10741170
~name,
10751171
~options={
1172+
?timeout,
10761173
?retry,
10771174
?repeats,
10781175
?concurrent,
@@ -1103,6 +1200,7 @@ module For: ForType = {
11031200
Ext.itObjAsync(~it=Ext.it, ~cases)(
11041201
~name,
11051202
~options={
1203+
?timeout,
11061204
?retry,
11071205
?repeats,
11081206
?concurrent,

0 commit comments

Comments
 (0)