Skip to content

beforeAll outside of describe increases the number of failed steps by 1 #7056

@dandv

Description

@dandv

Describe the bug

Having a beforeAll outside any describes leads to the test runner reporting an incorrect number of failed steps: one more than the actual number of tests that have failed.

Steps to Reproduce

deno test the script below:

import { assert } from '@std/assert';
import { describe, test, beforeAll } from '@std/testing/bdd';

beforeAll(() => {
   // A `beforeAll` outside the `describe`, even empty, increases the number of failed tests by 1
});

describe('the describe', () => {
   test('test 1', () => {
      assert(Math.random() < 0.0001);
   });
   test('test 2', () => {
      assert(Math.random() === 0.123456);
   });
});

The output will include FAILED | 0 passed | 1 failed (3 steps).

Expected behavior

The final test message should be FAILED | 0 passed | 1 failed (2 steps).

Environment

  • OS: Ubuntu 24.04
  • deno version: 2.7.7
  • jsr:@std/expect: 1.0.18
  • jsr:@std/testing: 1.0.17

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions