Attributes
Includes Deno configuration
Repository
Current version released
2 years ago
Dependencies
deno.land/x
Versions
Stej
Make Deno tests in the Jest way.
This module allow you to write tests like you did with Jest.
Getting started
Simply use the provided wrapper methods: describe
, test
import { describe, expect, test } from 'https://deno.land/x/stej/mod.ts'
const isString = (o: unknown) => typeof o === 'string'
describe('Sample1', async () => {
await describe('isString', async () => {
await test({ given: 'a string', should: 'return true' }, () => {
expect(isString('foo')).toBe(true)
})
await test({ given: 'a number', should: 'return false' }, () => {
expect(isString(345)).toBe(false)
})
})
})
describe
andtest
description supports astring
or{ given, should }
object
Run the test:
$ deno test demo/sample1.test.ts
Check file:///home/openhoat/dev/rnd/deno/stej/demo/sample1.test.ts
running 1 test from ./demo/sample1.test.ts
Sample1 ...
isString ...
given: a string
should: return true ... ok (4ms)
given: a number
should: return false ... ok (3ms)
isString ... ok (12ms)
Sample1 ... ok (18ms)
ok | 1 passed (3 steps) | 0 failed (30ms)
$ █
License
The MIT License