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

targeted-test-runner

v1.0.30

Published

CLI tool for running targeted tests by description

Downloads

119

Readme

Targeted Test Runner (tt)

A CLI tool for running specific tests by description without manually modifying test files.

Installation

npm install targeted-test-runner -g

Usage

tt --help

Basic Usage

Run all test files in the current directory:

tt

Run a specific test by its description:

tt "should handle user login"

The tool will:

  1. Find all test files in the current directory
  2. Fuzzy match the test description (if provided)
  3. Create a temporary file with .only added to the matched test (if description provided)
  4. Run the test(s)
  5. Clean up any temporary files

Examples

# Run all tests in the current directory
tt

# List all available tests
tt --list

# Run a specific test by description
tt "should handle user login"

# Run all tests matching a description
tt "login" --all

# Run all tests in a specific file
tt src/tests/auth.test.js

# Run tests in a specific file matching a description
tt src/tests/auth.test.js "login"

# Run all tests in a directory
tt src/tests/

# Run tests in a directory matching a description
tt src/tests/ "login"

Advanced Usage

Run Tests from a Specific File

Run tests from a specific file by providing the file path first:

tt ./path/to/test.js "test description"

Run All Matching Tests

Use the -a or --all flag to run all matching tests instead of just the best match:

# Run all tests matching the description
tt "test description" -a 

# Run all tests from a specific file matching the description
tt ./path/to/test.js "test description" -a 

Example

Given a test file test-file.test.js

// test-file.test.js
const { test } = require('uvu')
const assert = require('uvu/assert')

test('test one', () => {
  assert.equal(1, 1)
})

test('test two', () => {
  assert.equal(2, 2)
})

test.run()

You can target specific tests:

tt test-file.test.js "two"

This will automagically create a temp file with test.only applied to our matches:

// test-file.test.js
const { test } = require('uvu')
const assert = require('uvu/assert')

test('test one', () => {
  assert.equal(1, 1)
})

test.only('test two', () => {
  assert.equal(2, 2)
})

test.run()

Run specific tests:

# Run all test files in the directory
tt

# Run the best matching test with description matching "foo"
tt 'foo'

# Run all tests containing 'api requests'
tt 'api requests' --all

# Run tests only from a specific file
tt ./path/to/test.js 'test description xyz'

# Run all tests in a dir
tt ./path/to/dir

# Run tests only from a dir that match `xyz`
tt ./path/to/dir 'xyz'

# Run all matching tests from a specific file
tt ./path/to/test.js 'test' --all

Configuration

Debug Logging

Enable debug logging by setting the DEBUG environment variable:

DEBUG=tt:* tt 'test description'

Available debug namespaces:

  • tt:cli: CLI operations
  • tt:processor: Test file processing
  • tt:runner: Test execution

Development

Setup

npm install

Running Tests

npm test

Project Structure

.
├── src/
│   ├── index.js           # CLI entry point
│   └── utils/
│       ├── logger.js      # Logging configuration
│       ├── test-processor.js  # Test file processing
│       ├── test-runner.js # Test execution
│       └── cleanup.js     # Temporary file cleanup
├── tests/
│   ├── unit/             # Unit tests
│   └── integration/      # Integration tests
└── fixtures/             # Test fixtures

License

ISC