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

fix: allow all combinations of describe, it and test to skip modifier #746

Merged
merged 1 commit into from
Sep 7, 2024
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
11 changes: 10 additions & 1 deletion src/modules/helpers/modifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,16 @@ export const todo = (message: string, _cb?: () => unknown) =>
`${indentation.hasDescribe ? ' ' : ''}${format(`● ${message}`).cyan().bold()}`
);

export const skip = (message: string, _cb?: () => unknown) =>
export function skip(message: string, _cb: () => unknown): void;
export function skip(_cb: () => unknown): void;
export function skip(
messageOrCb: string | (() => unknown),
_cb?: () => unknown
) {
const message =
(typeof messageOrCb === 'string' && messageOrCb) || 'Skipping';

Write.log(
`${indentation.hasDescribe ? ' ' : ''}${format(`◯ ${message}`).info().bold()}`
);
}
4 changes: 4 additions & 0 deletions test/__fixtures__/e2e/final-results/skip-it/skip.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ it.skip('Some skip', () => {
it.skip('Multiple skips in the same file should not be counted', () => {
exit(1);
});

it.skip(() => {
exit(1);
});
4 changes: 3 additions & 1 deletion test/e2e/final-results.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ describe('Final Results', async () => {

assert.match(results.stdout, /PASS › 1/, 'Needs to pass 1');
assert.match(results.stdout, /FAIL › 0/, 'Needs to fail 0');
assert.match(results.stdout, /SKIP › 2/, 'Needs to skip 2');
assert.match(results.stdout, /SKIP › 3/, 'Needs to skip 3');
assert.match(results.stdout, /◯ Some skip/, 'User Messsage');
assert.match(results.stdout, /◯ Skipping/, 'No Messsage');
});

await it('Skip (describe)', async () => {
Expand Down
Loading