oven-sh / bun

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

`--bail` flag behavior to support space-separated arguments in `bun test` #15293

Open aralroca opened 1 day ago

aralroca commented 1 day ago

What version of Bun is running?

1.1.37-canary.10+61a3f0859

What platform is your computer?

No response

What steps can reproduce the bug?

Meanwhile with bun test all the tests pass ok, with bun test --bail 10 is looking for files with 10, so is not working.

> bun test --bail 10

bun test v1.1.37-canary.10 (61a3f085)
The following filters did not match any test files:
  10
2323 files were searched [62.00ms]

note: Tests need ".test", "_test_", ".spec" or "_spec_" in the filename (ex: "MyApp.test.ts")

Learn more about the test runner: https://bun.sh/docs/cli/test

What is the expected behavior?

Just run bun test --bail 10

What do you see instead?

No response

Additional information

No response

RiskyMH commented 1 day ago

If you do bun test --bail=10 it should work.


The issue arises because --bail is optional and can function without extra arguments. This ambiguity makes it unclear whether space-separated arguments are part of the flag or a separate test filter.

bun test --bail 10: does the user mean --bail=10 and filter by tests that contain "10", or is it --bail=10 and run all tests


While this is something we’d like to fix in the future, I’m not aware of a time when the space-separated version worked. I’ll update the documentation to reflect the current behavior.

aralroca commented 1 day ago

Ok, cool, then probably changing the documentation is enough