-
Notifications
You must be signed in to change notification settings - Fork 9
Adds test.for, it.for, and describe.for bindings #28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adds test.for, it.for, and describe.for bindings #28
Conversation
|
@cometkim Would you have some time soon to review this? Unfortunately |
|
Looks great. I don't think we need to keep both |
| ) | ||
| } | ||
|
|
||
| module type ForType = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add describe sets too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure!
It looks like it was introduced in vitest v3: vitest-dev/vitest#7253, should I add it with a warning that it's not compatible with v2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I should bump vitest version in the next release.
It doesn't have breaking changes that could affect rescript-vitest users? Let me check peerDeps and histories first.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://vitest.dev/guide/migration#vitest-3
There are some breaking changes, but mostly I can handle
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, when you go to bump it for devDependencies I forgot to push these tests:
For.describe(sumObj, "sum $a+$b=$sum", (i, t) => {
expect(t, i["a"] + i["b"])->Expect.toBe(i["sum"])
expect(t, i["a"] + i["b"] + 1)->Expect.not->Expect.toBe(i["sum"])
})
For.describe(sum2, "%i=%s", ((a, b), t) => {
expect(t, a->Js.Int.toString)->Expect.toBe(b)
expect(t, (a + 1)->Js.Int.toString)->Expect.not->Expect.toBe(b)
})
For.describe(sum3, "sum %i+%i=%s", ((a, b, sum), t) => {
expect(t, (a + b)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
For.describe(sum4, "sum %i+%i+%i=%s", ((a, b, c, sum), t) => {
expect(t, (a + b + c)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + c + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
For.describe(sum5, "sum %i+%i+%i+%i=%s", ((a, b, c, d, sum), t) => {
expect(t, (a + b + c + d)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + c + d + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
For.describeAsync(sumObj, "sum $a+$b=$sum", async (i, t) => {
expect(t, i["a"] + i["b"])->Expect.toBe(i["sum"])
expect(t, i["a"] + i["b"] + 1)->Expect.not->Expect.toBe(i["sum"])
})
For.describeAsync(sum2, "%i=%s", async ((a, b), t) => {
expect(t, a->Js.Int.toString)->Expect.toBe(b)
expect(t, (a + 1)->Js.Int.toString)->Expect.not->Expect.toBe(b)
})
For.describeAsync(sum3, "sum %i+%i=%s", async ((a, b, sum), t) => {
expect(t, (a + b)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
For.describeAsync(sum4, "sum %i+%i+%i=%s", async ((a, b, c, sum), t) => {
expect(t, (a + b + c)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + c + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
For.describeAsync(sum5, "sum %i+%i+%i+%i=%s", async ((a, b, c, d, sum), t) => {
expect(t, (a + b + c + d)->Js.Int.toString)->Expect.toBe(sum)
expect(t, (a + b + c + d + 1)->Js.Int.toString)->Expect.not->Expect.toBe(sum)
})
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
btw, descritbe has no test context
These have the test context passed as an argument, and preserves the array's tuple to be passed in as the first argument. This removes the need for the -N suffix bindings and allows use of the non-BuiltIn bindings
752ed1b to
3e4012a
Compare
introduced by #28 they shouldn't pass textCtx
These have the test context passed as an argument, and preserves the
array's tuple to be passed in as the first argument. This removes the
need for the -N suffix bindings and allows use of the non-BuiltIn
bindings