A Deno Testing Library
We don't just hate bugs, we detest them!
import { describe, it, test, runTests} from "./detest/detest.ts"
describe("testing", () => {
it("works", () => { 1 + 1 })"
describe("describes can be nested", () => {
test("1 + -1", () => expect(1 + (-1)).toBe(0))
test("1 + -3", () => expect(1 + (-3)).toBe(-2))
})
describe("async testing", () => {
it("is also possible", async () => {
let value = await fetchValue()
expect(value).toBe("found")
})
})
describe("before(each)", () => {
let setupValue
let resets
before(() => {
setupValue = 12345
})
beforeEach(() => {
resets = 0
})
it("should be 0", () => {
expect(resets).toBe(0)
resets++
})
it("should still be 0", () => expect(resets).toBe(0))
})
})
runTest()
function describe(description: string, callback: () => void): void
function it(description: string, callback: () => void | Promise<void>): void
function test
: Alias forit
.function before(callback: () => void): void
function beforeEach(callback: () => void): void
function expect(actual: any): DeferredExpectation
class DeferredExpectation
toBe(expected: any)
Run Tests
deno detest.test.ts
- after/afterEach
- expand expectation library
- async before(Each)