Skip to content

The deno test --filter CLI option does not filter individual BDD tests #6063

Open
@dandv

Description

@dandv

Describe the bug
During behavior-driven development it is useful to group tests into describes and also to be able to run tests individually. The test/t.step structure does not allow filtering for individual steps (and is not intended to). Therefore I resorted to the standard BDD library, but it turns our that filtering also only applies to the names of describe blocks, not test or it blocks.

Steps to Reproduce

  1. Create bdd.ts with the contents
import { describe, test, it } from 'jsr:@std/testing/bdd';
import { assertEquals } from '@std/assert';

describe('this is the describe', () => {
  test('test 1', () => {
    assertEquals(1, 1);
  });
  it('test 2', () => {
    assertEquals(2, 2);
  });
});
  1. Run deno test --filter /2/ bdd.ts
  2. Run deno test --filter "test 2" bdd.ts

Expected behavior

test 2 should execute.

Environment

  • OS: Fedora Linux 39
  • deno version: 1.46.3
  • std version: 1.0.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtesting

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions