deno
d7a4b010 - feat(test): add Deno.test.each for parameterized tests (#34938)

Commit
160 days ago
feat(test): add Deno.test.each for parameterized tests (#34938) Deno has no built-in way to run the same test body over a table of inputs. Today you either write a loop (which collapses every case into a single test and breaks editor "run this test" integration) or reach for a third party helper. This adds a vitest/jest-style `Deno.test.each` that registers one real test per case, so each case reports and can be filtered or run individually. Array cases are spread as positional arguments and object or primitive cases are passed as a single argument. The name template supports `printf`-style tokens that consume the case values (`%s`, `%d`/`%i`, `%f`, `%j`, `%o`), `%#` for the zero-based case index, and `$key`/`$key.nested` interpolation for object cases. The helper also composes with the existing shorthands as `Deno.test.only.each` and `Deno.test.ignore.each`, and accepts the usual per-test options object. Generated tests report the user's `.each(...)(...)` call site rather than the internal registration loop. Closes #30110
Author
Parents
Loading