Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Commit

Permalink
Deprecate in favor of std/testing/bdd.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleJune committed Apr 17, 2022
1 parent 677ad8e commit 92a9e8c
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macOS-latest]
deno: [v1.x, canary]
deno: [v1.x]
fail-fast: true
steps:
- name: Clone repository
Expand Down
25 changes: 14 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Test Suite

[![version](https://img.shields.io/badge/release-0.16.0-success)](https://deno.land/x/[email protected].0)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/[email protected].0/mod.ts)
[![version](https://img.shields.io/badge/release-0.16.1-success)](https://deno.land/x/[email protected].1)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/[email protected].1/mod.ts)
[![CI](https://github.com/udibo/test_suite/workflows/CI/badge.svg)](https://github.com/udibo/test_suite/actions?query=workflow%3ACI)
[![codecov](https://codecov.io/gh/udibo/test_suite/branch/main/graph/badge.svg?token=EFKGY72AAV)](https://codecov.io/gh/udibo/test_suite)
[![license](https://img.shields.io/github/license/udibo/test_suite)](https://github.com/udibo/test_suite/blob/master/LICENSE)

An extension of Deno's built-in test runner to add setup/teardown hooks and make
it easier to organize tests in a format similar to Jasmine, Jest, and Mocha.

This module is being archived. It has been added to Deno's standard library in
the testing directory. Use Deno's standard library instead.

## Features

- Ability to group tests together into test suites
Expand All @@ -26,12 +29,12 @@ also be imported directly from GitHub using raw content URLs.

```ts
// Import from Deno's third party module registry
import { describe, it } from "https://deno.land/x/[email protected].0/mod.ts";
import { describe, it } from "https://deno.land/x/[email protected].1/mod.ts";
// Import from GitHub
import {
describe,
it,
} from "https://raw.githubusercontent.com/udibo/test_suite/0.16.0/mod.ts";
} from "https://raw.githubusercontent.com/udibo/test_suite/0.16.1/mod.ts";
```

## Usage
Expand All @@ -54,7 +57,7 @@ except they are called before and after each individual test.
Below are some examples of how to use `describe` and `it` in tests.

See
[deno docs](https://doc.deno.land/https/deno.land/x/[email protected].0/mod.ts)
[deno docs](https://doc.deno.land/https/deno.land/x/[email protected].1/mod.ts)
for more information.

### Nested test grouping
Expand All @@ -67,13 +70,13 @@ import {
beforeEach,
describe,
it,
} from "https://deno.land/x/[email protected].0/mod.ts";
import { assertEquals } from "https://deno.land/std@0.133.0/testing/asserts.ts";
} from "https://deno.land/x/[email protected].1/mod.ts";
import { assertEquals } from "https://deno.land/std@0.135.0/testing/asserts.ts";
import {
getUser,
resetUsers,
User,
} from "https://deno.land/x/[email protected].0/examples/user.ts";
} from "https://deno.land/x/[email protected].1/examples/user.ts";

describe("user describe", () => {
let user: User;
Expand Down Expand Up @@ -131,13 +134,13 @@ test result: ok. 1 passed (5 steps); 0 failed; 0 ignored; 0 measured; 0 filtered
The example below can be found [here](examples/user_flat_test.ts).

```ts
import { describe, it } from "https://deno.land/x/[email protected].0/mod.ts";
import { assertEquals } from "https://deno.land/std@0.133.0/testing/asserts.ts";
import { describe, it } from "https://deno.land/x/[email protected].1/mod.ts";
import { assertEquals } from "https://deno.land/std@0.135.0/testing/asserts.ts";
import {
getUser,
resetUsers,
User,
} from "https://deno.land/x/[email protected].0/examples/user.ts";
} from "https://deno.land/x/[email protected].1/examples/user.ts";

interface UserContext {
user: User;
Expand Down
12 changes: 10 additions & 2 deletions describe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,11 @@ export interface it {
ignore<T>(...args: ItArgs<T>): void;
}

/** Registers an individual test case. */
/**
* Registers an individual test case.
*
* @deprecated Use https://deno.land/std/testing/bdd.ts instead.
*/
export function it<T>(...args: ItArgs<T>): void {
if (TestSuiteInternal.running) {
throw new Error(
Expand Down Expand Up @@ -371,7 +375,11 @@ export interface describe {
ignore<T>(...args: DescribeArgs<T>): TestSuite<T>;
}

/** Registers a test suite. */
/**
* Registers a test suite.
*
* @deprecated Use https://deno.land/std/testing/bdd.ts instead.
*/
export function describe<T>(
...args: DescribeArgs<T>
): TestSuite<T> {
Expand Down
6 changes: 3 additions & 3 deletions test_deps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ export {
assertRejects,
assertStrictEquals,
assertThrows,
} from "https://deno.land/std@0.133.0/testing/asserts.ts";
} from "https://deno.land/std@0.135.0/testing/asserts.ts";

export {
assertSpyCall,
assertSpyCalls,
spy,
stub,
} from "https://deno.land/std@0.133.0/testing/mock.ts";
} from "https://deno.land/std@0.135.0/testing/mock.ts";
export type {
Spy,
SpyCall,
Stub,
} from "https://deno.land/std@0.133.0/testing/mock.ts";
} from "https://deno.land/std@0.135.0/testing/mock.ts";

0 comments on commit 92a9e8c

Please sign in to comment.