Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file modified build.sh
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
{
"name": "feliz-packages",
"private": true,
"scripts": {
"publish-docs": "npm run build && node publish.js",
Expand Down
6 changes: 6 additions & 0 deletions src/Vitest/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion src/Vitest/Library.fs
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ type TestAPI =
type TestContext =
abstract member task: Task
abstract member expect: value: obj -> IAssertion<obj>
abstract member expect: value: obj * ?msg: string -> IAssertion<obj>
abstract member skip: unit -> unit
abstract member skip: note: string -> unit
abstract member skip: condition: bool -> unit
Expand Down Expand Up @@ -396,7 +397,7 @@ type Vitest =
// static member expectPromise<'a>(value: Promise<'a>) : IPromiseAssertion<'a> = jsNative

[<ImportMember("vitest")>]
static member expect<'a>(value: 'a) : IAssertion<'a> = jsNative
static member expect<'a>(value: 'a, ?msg : string) : IAssertion<'a> = jsNative

[<Import("expect", "vitest")>]
static member Expect: ExpectStatic = jsNative
Expand Down
12 changes: 12 additions & 0 deletions tests/Vitest/Program.test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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"
Expand Down