Skip to main content

Unitest

test deno land deno version deno doc codecov

Deno-first universal unit testing framework


:construction: This is beta

Features

  • Like jest but not jest
    You can express declarative tests around the symbolic expect in jest. Also, all matchers are composable and customizable. jest and jest-extended matchers are provided as presets.

  • Universal
    It is designed for use with Deno first and foremost.
    It is also compatible to work in browsers and Node.js environments.

  • Compositable
    Unitest is also intended to be used in a browser.
    For this reason, we provide a composable interface to keep the bundle size as small as possible.

  • TypeScript-first
    Type-safe tests can be expressed. A type filter restricts the availability of only those matchers that satisfy the data type under test.
    It also keeps the bundle size small by transferring part of the data type validation to TypeScript.

Getting Started

Visit https://unitest.vercel.app/ to get started with Unitest.

Quick view

import { expect, it } from "https://deno.land/x/unitest@$VERSION/mod.ts";

it("should not equal", () => {
  expect("Deno").not.toBe("Node");
});

Contributing

Please see our CONTRIBUTING.md.

License

Copyright Β© 2021-present TomokiMiyauci.

Released under the MIT license

TODO

  • Implement expecter and jest default matcher (rest)
    • toContainEqual
    • toMatchObject
    • toMatchSnapshot
    • toMatchInlineSnapshot
    • toStrictEqual
    • toThrowErrorMatchingSnapshot
    • toThrowErrorMatchingInlineSnapshot
  • Implement third party matcher (rest)
    • jest-extended
      • toBeEmpty
      • toBeArrayOfSize toHaveLength
      • toIncludeAllMembers
      • toIncludeAllPartialMembers
      • toIncludeAnyMembers
      • toIncludeSameMembers
      • toThrowWithMessage
      • toHaveBeenCalledBefore
      • toHaveBeenCalledAfter
      • toHaveBeenCalledOnce
      • toBeNaN exists in jest
      • toContainKey same as toHaveProperty
      • toContainAllKeys
      • toContainAnyKeys
      • toContainValue
      • toContainValues
      • toContainAllValues
      • toContainAnyValues
      • toContainEntry
      • toContainEntries
      • toContainAllEntries
      • toContainAnyEntries
      • toResolve not pure
      • toReject not pure
      • toBeHexadecimal
      • toBeDateString
      • toEqualCaseInsensitive
      • toEndWith
      • toInclude
      • toIncludeRepeated
      • toIncludeMultiple
      • toEqualIgnoringWhitespace
  • Implement interface of custom matcher
  • Implement it suite
  • Implement describe suite