deno_std icon indicating copy to clipboard operation
deno_std copied to clipboard

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

Open dandv opened this issue 1 year ago • 7 comments

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

dandv avatar Sep 26 '24 08:09 dandv