Skip to content
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

feat(testing): add .skip alias to bdd test API #3300

Merged
merged 1 commit into from
Apr 13, 2023
Merged
Show file tree
Hide file tree
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
13 changes: 13 additions & 0 deletions testing/bdd.ts
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,12 @@ export interface it {

/** Registers an individual test case with ignore set to true. */
ignore<T>(...args: ItArgs<T>): void;

/**
* Registers an individual test case with ignore set to true. Alias of
* `.ignore()`.
*/
skip<T>(...args: ItArgs<T>): void;
}

/** Registers an individual test case. */
Expand Down Expand Up @@ -504,6 +510,8 @@ it.ignore = function itIgnore<T>(...args: ItArgs<T>) {
});
};

it.skip = it.ignore;

function addHook<T>(
name: HookNames,
fn: (this: T) => void | Promise<void>,
Expand Down Expand Up @@ -684,6 +692,9 @@ export interface describe {

/** Registers a test suite with ignore set to true. */
ignore<T>(...args: DescribeArgs<T>): TestSuite<T>;

/** Registers a test suite with ignore set to true. Alias of `.ignore()`. */
skip<T>(...args: ItArgs<T>): void;
}

/** Registers a test suite. */
Expand Down Expand Up @@ -720,3 +731,5 @@ describe.ignore = function describeIgnore<T>(
ignore: true,
});
};

describe.skip = describe.ignore;
8 changes: 8 additions & 0 deletions testing/bdd_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,10 @@ Deno.test("global", async (t) => {
);
}));
});

await t.step(".skip is an alias of .ignore", () => {
assertEquals(it.ignore, it.skip);
});
});
});

Expand Down Expand Up @@ -1311,6 +1315,10 @@ Deno.test("global", async (t) => {
}),
);
});

await t.step(".skip is an alias of .ignore", () => {
assertEquals(describe.ignore, describe.skip);
});
});

await t.step("nested only", async (t) => {
Expand Down