denoland / denoland/std

--fail-fast doesn't work with describe/test

Open
#6,348 2 comments 0 reactions 0 assignees View on GitHub
enhancement suggestion
Dominant language
TypeScript
Stars
3.6k
Forks
681
PR merge metrics
No merged PRs in 30d

Description

**Describe the bug**

Passing `--fail-fast` to `deno test` is [documented](https://docs.deno.com/runtime/fundamentals/testing/#failing-fast) to stop on the first failure. This works with `Deno.test()`, but not with `describe` / `expect`.

**Steps to Reproduce**

**main_test.ts**:
```ts
import { describe, test } from '@std/testing/bdd';
import { assertEquals } from "@std/assert";

describe('addition', () => {
test(function addTest1() {
assertEquals(1 + 1, 42);
});

test(function addTest2() {
assertEquals(2 + 2, 4);
});
});
```

```sh
$ deno test --fail-fast
Check file:///home/dandv/deno-bugs/main_test.ts
running 1 test from ./main_test.ts
addition ...
addTest1 ... FAILED (7ms)
addTest2 ... ok (1ms)
addition ... FAILED (due to 1 failed step) (12ms)

ERRORS

addition ... addTest1 => https://jsr.io/@std/testing/1.0.9/_test_suite.ts:393:15
error: AssertionError: Values are not equal.
[...]
```

**Expected behavior**

`addTest2` should not have executed.

**Environment**

- OS: Fedora Linux 38
- deno version: 2.1.4
- std version: @std/testing@^1.0.9

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.