npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

deno-test-each

v0.4.0

Published

Parameterized testing utilities for Deno - run the same test with multiple inputs

Readme

deno-test-each

Vitest-compatible parameterized testing for Deno. Run the same test with multiple inputs using the familiar it.each() syntax.

Features

  • 🚀 Zero dependencies - Built for Deno's standard library
  • 📝 TypeScript support - Full type safety and IntelliSense
  • 🎯 Vitest-compatible - Familiar it.each() API
  • 🔧 Template interpolation - %s, %d, %j placeholders + $property syntax
  • 📊 Clear test output - Descriptive test names for each case
  • 🎛️ Case filtering - Run specific cases by index or predicate
  • Property interpolation - Access object properties in test names

Installation

Deno/JSR

deno add @andrea/deno-test-each
import { it } from "@andrea/deno-test-each";

Node.js/NPM

npm install deno-test-each
import { it } from "deno-test-each";

Usage

Basic Examples

import { it } from "deno-test-each";
import { assertEquals } from "jsr:@std/assert";

// Simple values
it.each([1, 2, 3, 4])("should be positive: %d", (n) => {
  assertEquals(n > 0, true);
});

// Array destructuring
it.each([
  [1, 2, 3],
  [2, 3, 5],
  [3, 4, 7],
])("adds %d + %d = %d", ([a, b, expected]) => {
  assertEquals(a + b, expected);
});

// Object cases
it.each([
  { input: "hello", expected: 5 },
  { input: "world", expected: 5 },
  { input: "", expected: 0 },
])("string length: %j", ({ input, expected }) => {
  assertEquals(input.length, expected);
});

Template Interpolation

Use placeholders in test names:

  • %s - String representation
  • %d - Number representation
  • %j - JSON representation
  • $property - Object property access (new in v0.4.0)

Property Interpolation

Access object properties directly in test names using $property syntax:

// Basic property access
it.each([
  { name: "positive case", value: 5 },
  { name: "negative case", value: -3 },
  { name: "zero case", value: 0 },
])("Testing $name with value $value", ({ name, value }) => {
  // Generates:
  // "Testing positive case with value 5"
  // "Testing negative case with value -3"
  // "Testing zero case with value 0"
  assertEquals(typeof value, "number");
});

// Nested property access
it.each([
  { user: { profile: { name: "Alice" } }, id: 1 },
  { user: { profile: { name: "Bob" } }, id: 2 },
])("User $user.profile.name has id $id", ({ user, id }) => {
  // Generates:
  // "User Alice has id 1"
  // "User Bob has id 2"
  assertEquals(user.profile.name.length > 0, true);
});

// Mixed syntax (combine $property with %j)
it.each([
  { name: "test1", data: { count: 10 } },
  { name: "test2", data: { count: 20 } },
])("Case $name with data %j", ({ name, data }) => {
  // Generates:
  // "Case test1 with data {"name":"test1","data":{"count":10}}"
  // "Case test2 with data {"name":"test2","data":{"count":20}}"
  assertEquals(data.count > 0, true);
});

Filtering Cases

Run only specific cases from your test array:

// Run all cases (default)
it.each([1, 2, 3, 4])("test: %d", (n) => {
  assertEquals(n > 0, true);
});

// Run only case at specific index
it.each([1, 2, 3, 4], 2)("test: %d", (n, index) => {
  // Only runs for case at index 2 (value: 3)
  assertEquals(n, 3);
});

// Run only cases matching predicate
it.each([1, 2, 3, 4], (value) => value > 2)("test: %d", (n) => {
  // Only runs for values 3 and 4
  assertEquals(n > 2, true);
});

// Predicate with index access
it.each([1, 2, 3, 4], (value, index) => index === 1 || value > 3)(
  "test: %d",
  (n) => {
    // Runs for index 1 (value: 2) OR values > 3 (value: 4)
  },
);

API Reference

it.each<T>(cases)(name, testFn)

Run all test cases.

Parameters:

  • cases: readonly T[] - Array of test cases
  • name: string - Test name template with optional placeholders
  • testFn: (value: T, index: number) => void | Promise<void> - Test function

it.each<T>(cases, index)(name, testFn)

Run only the test case at specific index.

Parameters:

  • cases: readonly T[] - Array of test cases
  • index: number - Index of case to run
  • name: string - Test name template
  • testFn: (value: T, index: number) => void | Promise<void> - Test function

it.each<T>(cases, filter)(name, testFn)

Run only test cases matching the filter predicate.

Parameters:

  • cases: readonly T[] - Array of test cases
  • filter: (value: T, index: number) => boolean - Filter predicate
  • name: string - Test name template
  • testFn: (value: T, index: number) => void | Promise<void> - Test function

License

MIT