Skip to content

Commit

Permalink
feat: support default test timeout in bunfig.toml
Browse files Browse the repository at this point in the history
  • Loading branch information
treyturner committed Sep 16, 2024
1 parent 3d68a94 commit d5a2fa9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
9 changes: 9 additions & 0 deletions docs/runtime/bunfig.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,15 @@ Same as the top-level `smol` field, but only applies to `bun test`.
smol = true
```

### `test.timeout`

A default timeout for each test in milliseconds. Default `5000`. Use `--timeout` to override.

```toml
[test]
timeout = 15000
```

### `test.coverage`

Enables coverage reporting. Default `false`. Use `--coverage` to override.
Expand Down
5 changes: 5 additions & 0 deletions src/bunfig.zig
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@ pub const Bunfig = struct {
this.ctx.runtime_options.smol = expr.data.e_boolean.value;
}

if (test_.get("timeout")) |expr| {
try this.expect(expr, .e_big_int);
this.ctx.test_options.default_timeout_ms = expr.data.e_big_int.value;
}

if (test_.get("coverage")) |expr| {
try this.expect(expr, .e_boolean);
this.ctx.test_options.coverage.enabled = expr.data.e_boolean.value;
Expand Down

0 comments on commit d5a2fa9

Please sign in to comment.