deno_std
deno_std copied to clipboard
The deno test --filter CLI option does not filter individual BDD tests
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
- Create
bdd.tswith 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);
});
});
- Run
deno test --filter /2/ bdd.ts - 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