Writing Tests in Deno

May 14, 2020

Deno comes built in with its own test runner (deno test) which will run tests against files which match {*_,}test.{js,ts,jsx,tsx}.

import { assert, equal } from 'https://deno.land/std/testing/asserts.ts';
Deno.test('check something is equal', () => {
  assert(1 === 1);
})
Deno.test('another test', () => {
  equal(1, 1);
})

Example output

deno test
running 2 tests
test check something is equal ... ok (1ms)
test another test ... ok (1ms)
test result: ok. 2 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out (3ms)

TODO more coming soon!