@lowlighter/testing
v6.0.0
Published
[](https://jsr.io/@libs/testing) [](https://jsr.io/@libs/testing) [` supports additional matchers", () => {
expect("https://example.com").toBeUrl()
expect("foo").toBeOneOf(["foo", "bar"])
expect(new Response(null, { status: Status.OK })).toRespondWithStatus("2XX")
})✨ Features
- Extends
@std/expectwith additional matchers (toBeIterable,toRespondWithStatus,toBeEmail, etc.)- See
@libs/testing/expectfor more information about available matchers.
- See
- Re-exports
@std/assertthrough@libs/testing/assert. - Re-exports
@faker-js/fakerthrough@libs/testing/faker. - Provides CLI syntax highlighting utilities through
@libs/testing/highlight(supportstypescript,css,markdown,html,diff,yamlandjson).
🕊️ Migrating from 5.x.x to 6.x.x
Dropped support of test() cross-runtime helper. This package now only provide testing utilities.
🕊️ Migrating from 3.x.x to 4.x.x
Test must be run through respective runtime
Previously, tests were run through Deno, but now you are supposed to run them through the runtime you want to test.
deno:deno testbun:bun testnode:npx tsx --test
Runtime selection must now be done by gating tests
The test() function is now directly the runner rather than a function that returns a runner.
- test()("foo", () => void null)
+ test("foo", () => void null)- test("node", "bun")("foo", () => void null)
+ if (runtime === "node" || runtime === "bun")
+ test("foo", () => void null)🕊️ Migrating from 2.x.x to 3.x.x
Version 3.x.x and onwards require Deno 2.x.x or later.
toBeType("object") and null
The toBeType("object") matcher now excludes null by default. The second argument has been replaced by an object with a nullable property for better readability.
- expect(null).toBeType("object", !null)
+ expect(null).toBeType("object", { nullable: true })Updated headers and syntax highlighting
The prefix for runtime in test names has been changed to be displayed in uppercase over a colored background. If you were using the deno test --filter option, you will need to update your filter accordingly.
- [deno]
+ DENOAdditionally, test names now syntax highlight everything specified in backticks.
📜 License
Copyright (c) Simon Lecoq <@lowlighter>. (MIT License)
https://github.com/lowlighter/libs/blob/main/LICENSE