The deno test --filter CLI option does not filter individual BDD tests
- Dominant language
- TypeScript
- Stars
- 3.6k
- Forks
- 681
- PR merge metrics
- No merged PRs in 30d
Description
**Describe the bug**
During [behavior-driven development](https://docs.deno.com/runtime/fundamentals/testing/#behavior-driven-development) it is useful to group `test`s into `describe`s and also to be able to run tests individually. The `test`/`t.step` structure [does not allow filtering for individual steps](https://github.com/denoland/docs/pull/899) (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
```ts
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);
});
});
```
2. Run `deno test --filter /2/ bdd.ts`
3. 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
Contributor guide
Assessment
This issue has not been assessed yet.