denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
98.07k stars 5.4k forks source link

`deno test --filter` doesn't seem working for step names #26997

Closed kt3k closed 2 days ago

kt3k commented 3 days ago

Assume we have a.js, like:

Deno.test("1", async (t) => {
  await t.step("2", () => {
  });
  await t.step("3", () => {
  });
});

If we filter with 2, then it can't find any test case:

$ deno test --filter=2 a.js

ok | 0 passed | 0 failed | 1 filtered out (1ms)

Is this by design, or should this execute subtest of matching name?

related: https://github.com/denoland/std/issues/6063

dsherret commented 2 days ago

Yeah, it's by design. This was one of my main arguments against the test step API when we landed it 😅

kt3k commented 2 days ago

Ah, ok. It's by design because we don't know the step names before executing each test case.

I created this issue because of the issue in std/testing/bdd https://github.com/denoland/std/issues/6063, but that might be addressed by mapping all describe/it cases to Deno.test, not to t.step.