From 30472f3732878ed604eba07cdbda0667b61273f5 Mon Sep 17 00:00:00 2001 From: Hyeseong Kim Date: Fri, 23 Aug 2024 04:55:46 +0900 Subject: [PATCH] Support uncurried mode (#27) Closes #26 --- README.md | 2 +- bsconfig.json | 1 - rescript.json | 1 - src/Vitest.res | 380 ++++++++++++++++++------------------------------- 4 files changed, 137 insertions(+), 247 deletions(-) diff --git a/README.md b/README.md index a09fed8..0f123b9 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ ReScript v10.1+ is required since v1.0.0. To use `Js.Promise2` and `async`/`await` for tests. -ReScript v11 can be used with `"uncurried": false` +ReScript v11.x with the [uncurried mode](https://rescript-lang.org/blog/uncurried-mode) is supported since v2.x (unreleased). ## Config diff --git a/bsconfig.json b/bsconfig.json index 3f5cb8e..f3f5ade 100644 --- a/bsconfig.json +++ b/bsconfig.json @@ -1,6 +1,5 @@ { "name": "rescript-vitest", - "uncurried": false, "namespace": false, "suffix": ".mjs", "sources": [ diff --git a/rescript.json b/rescript.json index cae0f94..d5b3f64 100644 --- a/rescript.json +++ b/rescript.json @@ -1,6 +1,5 @@ { "name": "rescript-vitest", - "uncurried": false, "namespace": false, "suffix": ".mjs", "sources": [ diff --git a/src/Vitest.res b/src/Vitest.res index 76a3a91..cbb1269 100644 --- a/src/Vitest.res +++ b/src/Vitest.res @@ -37,25 +37,26 @@ type benchOptions = { warmupIterations: option, } -module type Runner = { - let describe: (string, unit => Js.undefined, Js.undefined) => unit - - let test: (string, unit => Js.undefined, Js.undefined) => unit - let testAsync: (string, unit => promise, Js.undefined) => unit +type groupDef = (string, unit => Js.undefined, Js.undefined) => unit +type testDef = (string, unit => Js.undefined, Js.undefined) => unit +type testAsyncDef = (string, unit => promise, Js.undefined) => unit +type benchDef = (string, unit => Js.undefined, Js.undefined) => unit +type benchAsyncDef = (string, unit => promise, Js.undefined) => unit - let it: (string, unit => Js.undefined, Js.undefined) => unit - let itAsync: (string, unit => promise, Js.undefined) => unit - - let bench: (string, unit => Js.undefined, Js.undefined) => unit - let benchAsync: (string, unit => promise, Js.undefined) => unit +module type Runner = { + let describe: groupDef + let test: testDef + let testAsync: testAsyncDef + let it: testDef + let itAsync: testAsyncDef + let bench: benchDef + let benchAsync: benchAsyncDef } module type ConcurrentRunner = { - let describe: (string, unit => Js.undefined, Js.undefined) => unit - - let testAsync: (string, unit => promise, Js.undefined) => unit - - let itAsync: (string, unit => promise, Js.undefined) => unit + let describe: groupDef + let testAsync: testAsyncDef + let itAsync: testAsyncDef } module MakeRunner = (Runner: Runner) => { @@ -158,34 +159,25 @@ module MakeConcurrentRunner = (Runner: ConcurrentRunner) => { include MakeRunner({ @module("vitest") @val - external describe: (string, @uncurry (unit => Js.undefined), Js.undefined) => unit = - "describe" + external describe: groupDef = "describe" @module("vitest") @val - external test: (string, @uncurry (unit => Js.undefined), Js.undefined) => unit = "test" + external test: testDef = "test" @module("vitest") @val - external testAsync: (string, @uncurry (unit => promise), Js.undefined) => unit = "test" + external testAsync: testAsyncDef = "test" @module("vitest") @val - external it: (string, @uncurry (unit => Js.undefined), Js.undefined) => unit = "it" + external it: testDef = "it" @module("vitest") @val - external itAsync: (string, @uncurry (unit => promise), Js.undefined) => unit = "it" + external itAsync: testAsyncDef = "it" @module("vitest") @val - external bench: ( - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "bench" + external bench: benchDef = "bench" @module("vitest") @val - external benchAsync: ( - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "bench" + external benchAsync: benchAsyncDef = "bench" }) module Concurrent = { @@ -205,29 +197,14 @@ module Concurrent = { external concurrent_it: concurrent_it = "it" ) - @send - external describe: ( - concurrent_describe, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "concurrent" + @get + external describe: concurrent_describe => groupDef = "concurrent" - @send - external testAsync: ( - concurrent_test, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external testAsync: concurrent_test => testAsyncDef = "concurrent" - @send - external itAsync: ( - concurrent_it, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external itAsync: concurrent_it => testAsyncDef = "concurrent" include MakeConcurrentRunner({ let describe = describe(concurrent_describe) @@ -256,63 +233,33 @@ module Only = { external only_bench: only_bench = "bench" ) - @send - external describe: ( - only_describe, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "only" + @get + external describe: only_describe => groupDef = "only" - @send - external test: ( - only_test, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "only" + @get + external test: only_test => testDef = "only" - @send - external testAsync: ( - only_test, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "only" + @get + external testAsync: only_test => testAsyncDef = "only" - @send - external it: (only_it, string, @uncurry (unit => Js.undefined), Js.undefined) => unit = - "only" + @get + external it: only_it => testDef = "only" - @send - external itAsync: (only_it, string, @uncurry (unit => promise), Js.undefined) => unit = - "only" + @get + external itAsync: only_it => testAsyncDef = "only" - @send - external bench: ( - only_bench, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "only" + @get + external bench: only_bench => benchDef = "only" - @send - external benchAsync: ( - only_bench, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "only" + @get + external benchAsync: only_bench => benchAsyncDef = "only" include MakeRunner({ let describe = describe(only_describe) - let test = test(only_test) let testAsync = testAsync(only_test) - let it = it(only_it) let itAsync = itAsync(only_it) - let bench = bench(only_bench) let benchAsync = benchAsync(only_bench) }) @@ -333,29 +280,14 @@ module Only = { external concurrent_it: only_it => concurrent_it = "only" ) - @send - external describe: ( - concurrent_describe, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "concurrent" + @get + external describe: concurrent_describe => groupDef = "concurrent" - @send - external testAsync: ( - concurrent_test, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external testAsync: concurrent_test => testAsyncDef = "concurrent" - @send - external itAsync: ( - concurrent_it, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external itAsync: concurrent_it => testAsyncDef = "concurrent" include MakeConcurrentRunner({ let describe = describe(only_describe->concurrent_describe) @@ -385,63 +317,33 @@ module Skip = { external skip_bench: skip_bench = "bench" ) - @send - external describe: ( - skip_describe, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "skip" + @get + external describe: skip_describe => groupDef = "skip" - @send - external test: ( - skip_test, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "skip" + @get + external test: skip_test => testDef = "skip" - @send - external testAsync: ( - skip_test, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "skip" + @get + external testAsync: skip_test => testAsyncDef = "skip" - @send - external it: (skip_it, string, @uncurry (unit => Js.undefined), Js.undefined) => unit = - "skip" + @get + external it: skip_it => testDef = "skip" - @send - external itAsync: (skip_it, string, @uncurry (unit => promise), Js.undefined) => unit = - "skip" + @get + external itAsync: skip_it => testAsyncDef = "skip" - @send - external bench: ( - skip_bench, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "skip" + @get + external bench: skip_bench => benchDef = "skip" - @send - external benchAsync: ( - skip_bench, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "skip" + @get + external benchAsync: skip_bench => benchAsyncDef = "skip" include MakeRunner({ let describe = describe(skip_describe) - let test = test(skip_test) let testAsync = testAsync(skip_test) - let it = it(skip_it) let itAsync = itAsync(skip_it) - let bench = bench(skip_bench) let benchAsync = benchAsync(skip_bench) }) @@ -462,29 +364,14 @@ module Skip = { external concurrent_it: skip_it => concurrent_it = "skip" ) - @send - external describe: ( - concurrent_describe, - string, - @uncurry (unit => Js.undefined), - Js.undefined, - ) => unit = "concurrent" + @get + external describe: concurrent_describe => groupDef = "concurrent" - @send - external testAsync: ( - concurrent_test, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external testAsync: concurrent_test => testAsyncDef = "concurrent" - @send - external itAsync: ( - concurrent_it, - string, - @uncurry (unit => promise), - Js.undefined, - ) => unit = "concurrent" + @get + external itAsync: concurrent_it => testAsyncDef = "concurrent" include MakeConcurrentRunner({ let describe = describe(skip_describe->concurrent_describe) @@ -580,20 +467,20 @@ module Each: EachType = { external testObj: ( ~test: test, ~cases: array<'a>, - ) => (. ~name: string, ~f: @uncurry 'a => unit, ~timeout: Js.undefined) => unit = "each" + ) => (~name: string, ~f: @uncurry 'a => unit, ~timeout: Js.undefined) => unit = "each" @send external test2: ( ~test: test, ~cases: array<('a, 'b)>, - ) => (. ~name: string, ~f: @uncurry ('a, 'b) => unit, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry ('a, 'b) => unit, ~timeout: Js.undefined) => unit = "each" @send external test3: ( ~test: test, ~cases: array<('a, 'b, 'c)>, - ) => (. ~name: string, ~f: @uncurry ('a, 'b, 'c) => unit, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry ('a, 'b, 'c) => unit, ~timeout: Js.undefined) => unit = "each" @send @@ -601,7 +488,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b, 'c, 'd)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd) => unit, ~timeout: Js.undefined, ) => unit = "each" @@ -611,7 +498,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b, 'c, 'd, 'e)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd, 'e) => unit, ~timeout: Js.undefined, ) => unit = "each" @@ -620,7 +507,7 @@ module Each: EachType = { external testObjAsync: ( ~test: test, ~cases: array<'a>, - ) => (. ~name: string, ~f: @uncurry 'a => promise, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry 'a => promise, ~timeout: Js.undefined) => unit = "each" @send @@ -628,7 +515,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -638,7 +525,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b, 'c)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -648,7 +535,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b, 'c, 'd)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -658,7 +545,7 @@ module Each: EachType = { ~test: test, ~cases: array<('a, 'b, 'c, 'd, 'e)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd, 'e) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -667,20 +554,20 @@ module Each: EachType = { external describeObj: ( ~describe: describe, ~cases: array<'a>, - ) => (. ~name: string, ~f: @uncurry 'a => unit, ~timeout: Js.undefined) => unit = "each" + ) => (~name: string, ~f: @uncurry 'a => unit, ~timeout: Js.undefined) => unit = "each" @send external describe2: ( ~describe: describe, ~cases: array<('a, 'b)>, - ) => (. ~name: string, ~f: @uncurry ('a, 'b) => unit, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry ('a, 'b) => unit, ~timeout: Js.undefined) => unit = "each" @send external describe3: ( ~describe: describe, ~cases: array<('a, 'b, 'c)>, - ) => (. ~name: string, ~f: @uncurry ('a, 'b, 'c) => unit, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry ('a, 'b, 'c) => unit, ~timeout: Js.undefined) => unit = "each" @send @@ -688,7 +575,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b, 'c, 'd)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd) => unit, ~timeout: Js.undefined, ) => unit = "each" @@ -698,7 +585,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b, 'c, 'd, 'e)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd, 'e) => unit, ~timeout: Js.undefined, ) => unit = "each" @@ -707,7 +594,7 @@ module Each: EachType = { external describeObjAsync: ( ~describe: describe, ~cases: array<'a>, - ) => (. ~name: string, ~f: @uncurry 'a => promise, ~timeout: Js.undefined) => unit = + ) => (~name: string, ~f: @uncurry 'a => promise, ~timeout: Js.undefined) => unit = "each" @send @@ -715,7 +602,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -725,7 +612,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b, 'c)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -735,7 +622,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b, 'c, 'd)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -745,7 +632,7 @@ module Each: EachType = { ~describe: describe, ~cases: array<('a, 'b, 'c, 'd, 'e)>, ) => ( - . ~name: string, + ~name: string, ~f: @uncurry ('a, 'b, 'c, 'd, 'e) => promise, ~timeout: Js.undefined, ) => unit = "each" @@ -753,47 +640,47 @@ module Each: EachType = { @inline let test = (cases, name, ~timeout=?, f) => - Ext.testObj(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.testObj(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test2 = (cases, name, ~timeout=?, f) => - Ext.test2(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test2(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test3 = (cases, name, ~timeout=?, f) => - Ext.test3(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test3(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test4 = (cases, name, ~timeout=?, f) => - Ext.test4(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test4(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test5 = (cases, name, ~timeout=?, f) => - Ext.test5(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test5(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let testAsync = (cases, name, ~timeout=?, f) => - Ext.testObjAsync(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.testObjAsync(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test2Async = (cases, name, ~timeout=?, f) => - Ext.test2Async(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test2Async(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test3Async = (cases, name, ~timeout=?, f) => - Ext.test3Async(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test3Async(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test4Async = (cases, name, ~timeout=?, f) => - Ext.test4Async(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test4Async(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let test5Async = (cases, name, ~timeout=?, f) => - Ext.test5Async(~test=Ext.test, ~cases)(. ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) + Ext.test5Async(~test=Ext.test, ~cases)(~name, ~f, ~timeout=timeout->Js.Undefined.fromOption) @inline let describe = (cases, name, ~timeout=?, f) => - Ext.describeObj(~describe=Ext.describe, ~cases)(. + Ext.describeObj(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -801,7 +688,7 @@ module Each: EachType = { @inline let describe2 = (cases, name, ~timeout=?, f) => - Ext.describe2(~describe=Ext.describe, ~cases)(. + Ext.describe2(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -809,7 +696,7 @@ module Each: EachType = { @inline let describe3 = (cases, name, ~timeout=?, f) => - Ext.describe3(~describe=Ext.describe, ~cases)(. + Ext.describe3(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -817,7 +704,7 @@ module Each: EachType = { @inline let describe4 = (cases, name, ~timeout=?, f) => - Ext.describe4(~describe=Ext.describe, ~cases)(. + Ext.describe4(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -825,7 +712,7 @@ module Each: EachType = { @inline let describe5 = (cases, name, ~timeout=?, f) => - Ext.describe5(~describe=Ext.describe, ~cases)(. + Ext.describe5(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -833,7 +720,7 @@ module Each: EachType = { @inline let describeAsync = (cases, name, ~timeout=?, f) => - Ext.describeObjAsync(~describe=Ext.describe, ~cases)(. + Ext.describeObjAsync(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -841,7 +728,7 @@ module Each: EachType = { @inline let describe2Async = (cases, name, ~timeout=?, f) => - Ext.describe2Async(~describe=Ext.describe, ~cases)(. + Ext.describe2Async(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -849,7 +736,7 @@ module Each: EachType = { @inline let describe3Async = (cases, name, ~timeout=?, f) => - Ext.describe3Async(~describe=Ext.describe, ~cases)(. + Ext.describe3Async(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -857,7 +744,7 @@ module Each: EachType = { @inline let describe4Async = (cases, name, ~timeout=?, f) => - Ext.describe4Async(~describe=Ext.describe, ~cases)(. + Ext.describe4Async(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -865,7 +752,7 @@ module Each: EachType = { @inline let describe5Async = (cases, name, ~timeout=?, f) => - Ext.describe5Async(~describe=Ext.describe, ~cases)(. + Ext.describe5Async(~describe=Ext.describe, ~cases)( ~name, ~f, ~timeout=timeout->Js.Undefined.fromOption, @@ -898,43 +785,41 @@ module Todo = { @inline let it = name => todo_it->it(name) } -@module("vitest") @val external beforeEach: (@uncurry (unit => unit)) => unit = "beforeEach" +@module("vitest") @val external beforeEach: (@uncurry unit => unit) => unit = "beforeEach" @module("vitest") @val -external beforeEachPromise: (@uncurry (unit => promise<'a>), Js.Undefined.t) => unit = +external beforeEachPromise: (@uncurry unit => promise<'a>, Js.Undefined.t) => unit = "beforeEach" @inline let beforeEachPromise = (~timeout=?, callback) => beforeEachPromise(callback, timeout->Js.Undefined.fromOption) -@module("vitest") external beforeAll: (@uncurry (unit => unit)) => unit = "beforeAll" +@module("vitest") external beforeAll: (@uncurry unit => unit) => unit = "beforeAll" @module("vitest") -external beforeAllPromise: (@uncurry (unit => promise<'a>), Js.Undefined.t) => unit = - "beforeAll" +external beforeAllPromise: (@uncurry unit => promise<'a>, Js.Undefined.t) => unit = "beforeAll" @inline let beforeAllPromise = (~timeout=?, callback) => beforeAllPromise(callback, timeout->Js.Undefined.fromOption) -@module("vitest") external afterEach: (@uncurry (unit => unit)) => unit = "afterEach" +@module("vitest") external afterEach: (@uncurry unit => unit) => unit = "afterEach" @module("vitest") -external afterEachPromise: (@uncurry (unit => promise<'a>), Js.Undefined.t) => unit = - "afterEach" +external afterEachPromise: (@uncurry unit => promise<'a>, Js.Undefined.t) => unit = "afterEach" @inline let afterEachPromise = (~timeout=?, callback) => afterEachPromise(callback, timeout->Js.Undefined.fromOption) @module("vitest") -external afterAll: (@uncurry (unit => 'a), Js.Undefined.t) => unit = "afterAll" +external afterAll: (@uncurry unit => 'a, Js.Undefined.t) => unit = "afterAll" let afterAll = (~timeout=?, callback) => afterAll(callback, timeout->Js.Undefined.fromOption) @module("vitest") -external afterAllPromise: (@uncurry (unit => promise<'a>), Js.Undefined.t) => unit = "afterAll" +external afterAllPromise: (@uncurry unit => promise<'a>, Js.Undefined.t) => unit = "afterAll" @inline let afterAllPromise = (~timeout=?, callback) => @@ -1059,23 +944,29 @@ module Matchers = ( module List = { @inline let toContain = (expected, item) => { - expected->dangerously_reinforce_assertion(Belt.List.toArray)->Array.toContain(item) + expected + ->dangerously_reinforce_assertion(list => list->Belt.List.toArray) + ->Array.toContain(item) } @inline let toContainEqual = (expected, item) => { - expected->dangerously_reinforce_assertion(Belt.List.toArray)->Array.toContainEqual(item) + expected + ->dangerously_reinforce_assertion(list => list->Belt.List.toArray) + ->Array.toContainEqual(item) } @inline let toHaveLength = (expected, length) => { - expected->dangerously_reinforce_assertion(Belt.List.toArray)->Array.toHaveLength(length) + expected + ->dangerously_reinforce_assertion(list => list->Belt.List.toArray) + ->Array.toHaveLength(length) } @inline let toMatch = (expected, list) => { expected - ->dangerously_reinforce_assertion(Belt.List.toArray) + ->dangerously_reinforce_assertion(list => list->Belt.List.toArray) ->Array.toMatch(list->Belt.List.toArray) } } @@ -1232,7 +1123,8 @@ module Vi = { } @send - external waitForAsync: (t, @uncurry unit => promise<'a>, waitForOptions) => promise<'a> = "waitFor" + external waitForAsync: (t, @uncurry unit => promise<'a>, waitForOptions) => promise<'a> = + "waitFor" /** @since(vitest >= 0.34.5) @@ -1280,23 +1172,23 @@ module InSource = { // Therefore, `MakeRunner` cannot be reused here. @scope("import.meta.vitest") @val - external describe: (string, @uncurry (unit => unit)) => unit = "describe" + external describe: (string, @uncurry unit => unit) => unit = "describe" @scope("import.meta.vitest") @val - external test: (string, @uncurry (unit => unit)) => unit = "test" + external test: (string, @uncurry unit => unit) => unit = "test" @scope("import.meta.vitest") @val - external testAsync: (string, @uncurry (unit => promise)) => unit = "test" + external testAsync: (string, @uncurry unit => promise) => unit = "test" @scope("import.meta.vitest") @val - external it: (string, @uncurry (unit => unit)) => unit = "it" + external it: (string, @uncurry unit => unit) => unit = "it" @scope("import.meta.vitest") @val - external itAsync: (string, @uncurry (unit => promise)) => unit = "it" + external itAsync: (string, @uncurry unit => promise) => unit = "it" @scope("import.meta.vitest") @val - external bench: (string, @uncurry (unit => unit)) => unit = "it" + external bench: (string, @uncurry unit => unit) => unit = "it" @scope("import.meta.vitest") @val - external benchAsync: (string, @uncurry (unit => promise)) => unit = "it" + external benchAsync: (string, @uncurry unit => promise) => unit = "it" }