diff --git a/build.sh b/build.sh old mode 100644 new mode 100755 diff --git a/package-lock.json b/package-lock.json index d339fe80..17b30d5b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,10 +1,10 @@ { - "name": "Feliz", + "name": "feliz-packages", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "Feliz", + "name": "feliz-packages", "workspaces": [ "src/*", "tests/*", diff --git a/package.json b/package.json index f6719570..f0f960c6 100644 --- a/package.json +++ b/package.json @@ -1,4 +1,5 @@ { + "name": "feliz-packages", "private": true, "scripts": { "publish-docs": "npm run build && node publish.js", diff --git a/src/Vitest/CHANGELOG.md b/src/Vitest/CHANGELOG.md index 9c6efaf0..22c89fa4 100644 --- a/src/Vitest/CHANGELOG.md +++ b/src/Vitest/CHANGELOG.md @@ -7,6 +7,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## 1.0.0-rc.2 - 2025-10-20 + +### Changed + +- PR #680: Add support for optional message in expect API (by @MangelMaxime) + ## 1.0.0-rc.1 - 2025-09-18 ### Added diff --git a/src/Vitest/Library.fs b/src/Vitest/Library.fs index 838c95c8..4b0c09d4 100644 --- a/src/Vitest/Library.fs +++ b/src/Vitest/Library.fs @@ -239,6 +239,7 @@ type TestAPI = type TestContext = abstract member task: Task abstract member expect: value: obj -> IAssertion + abstract member expect: value: obj * ?msg: string -> IAssertion abstract member skip: unit -> unit abstract member skip: note: string -> unit abstract member skip: condition: bool -> unit @@ -396,7 +397,7 @@ type Vitest = // static member expectPromise<'a>(value: Promise<'a>) : IPromiseAssertion<'a> = jsNative [] - static member expect<'a>(value: 'a) : IAssertion<'a> = jsNative + static member expect<'a>(value: 'a, ?msg : string) : IAssertion<'a> = jsNative [] static member Expect: ExpectStatic = jsNative diff --git a/tests/Vitest/Program.test.fs b/tests/Vitest/Program.test.fs index 35d8bea9..d7c4974f 100644 --- a/tests/Vitest/Program.test.fs +++ b/tests/Vitest/Program.test.fs @@ -28,6 +28,12 @@ Vitest.describe("Vitest basics", fun () -> Vitest.expect(result).toBe(5) ) + Vitest.test("sum adds two numbers with custom message", fun () -> + let result = Examples.sum 2 3 + // To test this API, you need to make the test fail and check the message in the output + Vitest.expect(result, "custom message, value should be 5").toBe(5) + ) + Vitest.test("TestOptions timeout", TestOptions(timeout = 1000), fun () -> let result = Examples.sum 2 3 Vitest.expect(result).toBe(5) @@ -198,6 +204,12 @@ Vitest.describe("TextContext", fun () -> ctx.expect(result).toBe(5) ) + Vitest.test("sum adds two numbers with context and custom message", fun (ctx: TestContext) -> + let result = Examples.sum 2 3 + // To test this API, you need to make the test fail and check the message in the output + ctx.expect(result, "custom message, value should be 5").toBe(5) + ) + Vitest.test("sum adds two numbers with context", fun (ctx: TestContext) -> ctx.skip() failwith "This test should be skipped"