Skip to content

fix(testing): add missing methods to test alias of it #6222

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Dec 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 74 additions & 0 deletions testing/bdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -741,6 +741,80 @@
it(...args);
}

/**
* Only execute this test case.
*
* @example Usage
* ```ts
* import { describe, test } from "@std/testing/bdd";
* import { assertEquals } from "@std/assert";
*
* describe("example", () => {
* test("should pass", () => {
* assertEquals(2 + 2, 4);
* });
*
* test.only("should pass too", () => {
* assertEquals(3 + 4, 7);
* });
* });
* ```
*
* @param args The test case
*/

Check warning on line 764 in testing/bdd.ts

View check run for this annotation

Codecov / codecov/patch

testing/bdd.ts#L764

Added line #L764 was not covered by tests
test.only = function itOnly<T>(...args: ItArgs<T>): void {
it.only(...args);
};

/**
* Ignore this test case.
*
* @example Usage
* ```ts
* import { describe, test } from "@std/testing/bdd";
* import { assertEquals } from "@std/assert";
*
* describe("example", () => {
* test("should pass", () => {
* assertEquals(2 + 2, 4);
* });
*
* test.ignore("should pass too", () => {
* assertEquals(3 + 4, 7);
* });
* });
* ```
*
* @param args The test case
*/

Check warning on line 789 in testing/bdd.ts

View check run for this annotation

Codecov / codecov/patch

testing/bdd.ts#L789

Added line #L789 was not covered by tests
test.ignore = function itIgnore<T>(...args: ItArgs<T>): void {
it.ignore(...args);
};

/** Skip this test case.
*
* @example Usage
* ```ts
* import { describe, test } from "@std/testing/bdd";
* import { assertEquals } from "@std/assert";
*
* describe("example", () => {
* test("should pass", () => {
* assertEquals(2 + 2, 4);
* });
*
* test.skip("should pass too", () => {
* assertEquals(3 + 4, 7);
* });
* });
* ```
*
* @param args The test case
*/

Check warning on line 813 in testing/bdd.ts

View check run for this annotation

Codecov / codecov/patch

testing/bdd.ts#L813

Added line #L813 was not covered by tests
test.skip = function itSkip<T>(...args: ItArgs<T>): void {
it.ignore(...args);
};

function addHook<T>(
name: HookNames,
fn: (this: T) => void | Promise<void>,
Expand Down