oven-sh / bun

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

`test.todo` not failing when test is already passing #8478

Open simylein opened 8 months ago

simylein commented 8 months ago

What version of Bun is running?

1.0.25+a8ff7be64

What platform is your computer?

Darwin 23.3.0 arm64 arm

What steps can reproduce the bug?

The description states that test.todo passes as long as the test fails because it is still todo, but that it fails as soon as the test starts to pass.

Screenshot 2024-01-25 at 13 02 57
import { expect, test } from 'bun:test';

test.todo('this should not pass because it is no longer todo', () => {
    expect(true).toEqual(true);
});

What is the expected behavior?

bun test v1.0.25 (a8ff7be6)

src/main.spec.ts:
✗ this should not pass because it is no longer todo

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

What do you see instead?

bun test v1.0.25 (a8ff7be6)

src/main.spec.ts:
✎ this should not pass because it is no longer todo

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

Additional information

No response

nektro commented 8 months ago

does this reproduce for you if you run with --todo ?

simylein commented 8 months ago

Nope, in that case it fails correctly

bun test v1.0.25 (a8ff7be6)

src/main.spec.ts:
✗ this should not pass because it is no longer todo [1.38ms]
  ^ this test is marked as todo but passes. Remove `.todo` or check that test is correct.

 0 pass
 1 fail
 1 expect() calls
Ran 1 tests across 1 files. [5.00ms]
IlyaCherkasov commented 3 weeks ago

If described above is expected behavior, then in v1.1.26 it behaves exactly the same. If you run with --test flag, then it won't pass. But without it only marks as todo although it already passes.