Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/ncphillips/detest
A Deno Testing Library
https://github.com/ncphillips/detest
Last synced: 3 months ago
JSON representation
A Deno Testing Library
- Host: GitHub
- URL: https://github.com/ncphillips/detest
- Owner: ncphillips
- Created: 2018-09-14T22:09:28.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-09-21T13:27:40.000Z (about 6 years ago)
- Last Synced: 2024-07-16T07:39:06.886Z (4 months ago)
- Language: TypeScript
- Size: 43 KB
- Stars: 5
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome-deno - detest - A Deno Testing Library. (Libraries)
README
# Detest
A [Deno](https://github.com/denoland/deno) Testing Library
> We don't just hate bugs, we detest them!
## Use
```typescript
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 resetsbefore(() => {
setupValue = 12345
})beforeEach(() => {
resets = 0
})it("should be 0", () => {
expect(resets).toBe(0)resets++
})
it("should still be 0", () => expect(resets).toBe(0))
})
})runTest()
```### API
* `function describe(description: string, callback: () => void): void`
* `function it(description: string, callback: () => void | Promise): void`
* `function test`: Alias for `it`.
* `function before(callback: () => void): void`
* `function beforeEach(callback: () => void): void`
* `function expect(actual: any): DeferredExpectation`
* `class DeferredExpectation`
* `toBe(expected: any)`## Development
Run Tests
```bash
deno detest.test.ts
```## Roadmap
* after/afterEach
* expand expectation library
* async before(Each)