run all tests with "addition" in the name
bun test --test-name-pattern addition
The pattern is matched against a concatenated string of the test name prepended with the labels of all its parent describe blocks, separated by spaces. For example, a test defined as:
math.test.ts
describe("Math", () => { describe("operations", () => { test("should add correctly", () => { // ... }); }); });
Would be matched against the string “Math operations should add correctly”.
###
[
](#changing-the-root-directory)
Changing the Root Directory
By default, Bun looks for test files starting from the current working directory. You can change this with the `root` option in your `bunfig.toml`:
bunfig.toml
[test] root = "src" # Only scan for tests in the src directory
##
[
](#execution-order)
Execution Order
Tests are run in the following order:
1. Test files are executed sequentially (not in parallel)
2. Within each file, tests run sequentially based on their definition order
Was this page helpful?
[Suggest edits](https://github.com/oven-sh/bun/edit/main/docs/test/discovery.mdx)[Raise issue](<https://github.com/oven-sh/bun/issues/new?title=Issue on docs&body=Path: /test/discovery>)
[
Runtime behavior
Previous
](../runtime-behavior/index.md)[
Lifecycle hooks
Next
](../lifecycle/index.md)