oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.09k stars 2.47k forks source link

allow `bun:test.test` modifiers to be chained #10885

Open nektro opened 1 week ago

nektro commented 1 week ago

What is the problem this feature would solve?

test.todo().only( cannot be done test.skip().todo( cannot be done

What is the feature you are proposing to solve the problem?

import { test, expect } from "bun:test";

const foo = true;
const bar = false;

test.skipIf(foo).todoIf(bar)("booleans should work", () => {
  expect(true).toBeTrue();
});

What alternatives have you considered?

❯ bun-debug test test/x.test.ts
bun test v1.1.8 (1da810ad)

test/x.test.ts:
1 | import { test, expect } from "bun:test";
2 | 
3 | const foo = true;
4 | const bar = false;
5 | 
6 | test.skipIf(foo).todoIf(bar)("booleans should work", () => {
    ^
TypeError: test.skipIf(foo).todoIf is not a function. (In 'test.skipIf(foo).todoIf(bar)', 'test.skipIf(foo).todoIf' is undefined)
      at /Users/meghandenny/src/bun/test/x.test.ts:6:1
      at asyncFunctionResume (:1:21)
      at promiseReactionJobWithoutPromiseUnwrapAsyncContext (:1:21)
      at promiseReactionJob (:1:21)

 0 pass
 1 fail
Ran 1 tests across 1 files. [164.00ms]