frangelbarrera/trash-tests

Find weak tests before they become a false-green CI. Deterministic test-effectiveness analysis for JavaScript & TypeScript: no-assertion & trivial-assertion detection, 0-100 suite score, PR reviews via GitHub Action. Zero config: npx trashtests scan. Works with Jest, Vitest, Mocha & Ava.

TypeScript

6

0 commits

updated Sep 1, 2026

See the code
code-quality
code-review
developer-experience
github-actions
javascript
jest
static-analysis
test-effectiveness
testing
test-quality
typescript
vitest

README

Trash Tests — test effectiveness checks for JavaScript and TypeScript

Trash Tests

Find weak tests before they become a false CI signal.

Deterministic test-effectiveness checks for JavaScript and TypeScript.

Apache-2.0 license Continuous integration Node.js 20 or later JavaScript and TypeScript

What Trash Tests checks

A passing test suite and high coverage do not guarantee that tests protect behavior. Trash Tests reviews test code for weak assertions, explains the finding, and produces a clear report for local development and pull requests.

Trash Tests terminal report showing weak-test findings

The report above is generated from the repository's decorative fixture corpus. It shows the score, finding counts, measured signals, and a concrete location to review.

TRASH TESTS — test quality checks

24 tests analyzed. Score: 72 / 100
1 weak test and 2 warnings found.

1. src/profile.test.ts › "loads a profile"
   Finding: Test body contains no recognized assertion.

Quick start

Run against changed tests in the current repository:

npx trashtests scan

Run a full repository review:

npx trashtests scan --scan-all

Include Istanbul coverage data when it is available:

npx trashtests scan --coverage ./coverage/coverage-final.json

Use structured output in automation:

npx trashtests scan --json > trashtests-report.json
npx trashtests scan --markdown > trashtests-report.md

GitHub Action

Add Trash Tests to pull requests to review changed test files and publish a concise summary.

name: Test quality

on:
  pull_request:
    paths:
      - '**/*.js'
      - '**/*.jsx'
      - '**/*.ts'
      - '**/*.tsx'

permissions:
  contents: read
  pull-requests: write

jobs:
  trash-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v7
        with:
          node-version: 20
          cache: npm

      - run: npm ci
      - run: npm test -- --coverage

      - name: Review changed tests
        uses: frangelbarrera/trash-tests/packages/github-action@v1
        with:
          post-comment: true
          coverage-path: ./coverage/coverage-final.json

Run the Action with pull_request, not pull_request_target, when analyzing code from forks. Keep write permissions and secrets away from untrusted pull-request code. The v1 reference is the stable major-release tag for workflow consumers.

Checks

CheckSeverityPurpose
no-assertionCriticalFinds executable tests with no recognized assertion.
trivial-assertionWarningFinds tautologies and isolated low-signal assertions.

Trash Tests supports JavaScript and TypeScript test files and recognizes Vitest, Jest, Mocha, Ava, Node assertions, fast-check, common type assertions, and Vitest Browser assertions. When coverage data is supplied, it also reports repository branch coverage.

Configuration

Create a configuration file with:

npx trashtests init

The generated trashtests.config.ts controls scanning scope, score weights, thresholds, disabled checks, and documented suppressions. See docs/configuration.md for the complete configuration reference.

Development

pnpm install --frozen-lockfile
pnpm lint
pnpm typecheck
pnpm build
pnpm test
pnpm verify

pnpm verify runs formatting, type checks, builds, tests, score-stability checks, and a clean npm package-consumption test.

For contribution guidance, read CONTRIBUTING.md. For release steps, read RELEASING.md. For security reporting, read SECURITY.md.

License

Trash Tests is available under the Apache License 2.0.

frangelbarrera/trash-tests

Find weak tests before they become a false-green CI. Deterministic test-effectiveness analysis for JavaScript & TypeScript: no-assertion & trivial-assertion detection, 0-100 suite score, PR reviews via GitHub Action. Zero config: npx trashtests scan. Works with Jest, Vitest, Mocha & Ava.

TypeScript

6

0 commits

updated Sep 1, 2026

See the code
code-quality
code-review
developer-experience
github-actions
javascript
jest
static-analysis
test-effectiveness
testing
test-quality
typescript
vitest

README

Trash Tests — test effectiveness checks for JavaScript and TypeScript

Trash Tests

Find weak tests before they become a false CI signal.

Deterministic test-effectiveness checks for JavaScript and TypeScript.

Apache-2.0 license Continuous integration Node.js 20 or later JavaScript and TypeScript

What Trash Tests checks

A passing test suite and high coverage do not guarantee that tests protect behavior. Trash Tests reviews test code for weak assertions, explains the finding, and produces a clear report for local development and pull requests.

Trash Tests terminal report showing weak-test findings

The report above is generated from the repository's decorative fixture corpus. It shows the score, finding counts, measured signals, and a concrete location to review.

TRASH TESTS — test quality checks

24 tests analyzed. Score: 72 / 100
1 weak test and 2 warnings found.

1. src/profile.test.ts › "loads a profile"
   Finding: Test body contains no recognized assertion.

Quick start

Run against changed tests in the current repository:

npx trashtests scan

Run a full repository review:

npx trashtests scan --scan-all

Include Istanbul coverage data when it is available:

npx trashtests scan --coverage ./coverage/coverage-final.json

Use structured output in automation:

npx trashtests scan --json > trashtests-report.json
npx trashtests scan --markdown > trashtests-report.md

GitHub Action

Add Trash Tests to pull requests to review changed test files and publish a concise summary.

name: Test quality

on:
  pull_request:
    paths:
      - '**/*.js'
      - '**/*.jsx'
      - '**/*.ts'
      - '**/*.tsx'

permissions:
  contents: read
  pull-requests: write

jobs:
  trash-tests:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v7
        with:
          fetch-depth: 0

      - uses: actions/setup-node@v7
        with:
          node-version: 20
          cache: npm

      - run: npm ci
      - run: npm test -- --coverage

      - name: Review changed tests
        uses: frangelbarrera/trash-tests/packages/github-action@v1
        with:
          post-comment: true
          coverage-path: ./coverage/coverage-final.json

Run the Action with pull_request, not pull_request_target, when analyzing code from forks. Keep write permissions and secrets away from untrusted pull-request code. The v1 reference is the stable major-release tag for workflow consumers.

Checks

CheckSeverityPurpose
no-assertionCriticalFinds executable tests with no recognized assertion.
trivial-assertionWarningFinds tautologies and isolated low-signal assertions.

Trash Tests supports JavaScript and TypeScript test files and recognizes Vitest, Jest, Mocha, Ava, Node assertions, fast-check, common type assertions, and Vitest Browser assertions. When coverage data is supplied, it also reports repository branch coverage.

Configuration

Create a configuration file with:

npx trashtests init

The generated trashtests.config.ts controls scanning scope, score weights, thresholds, disabled checks, and documented suppressions. See docs/configuration.md for the complete configuration reference.

Development

pnpm install --frozen-lockfile
pnpm lint
pnpm typecheck
pnpm build
pnpm test
pnpm verify

pnpm verify runs formatting, type checks, builds, tests, score-stability checks, and a clean npm package-consumption test.

For contribution guidance, read CONTRIBUTING.md. For release steps, read RELEASING.md. For security reporting, read SECURITY.md.

License

Trash Tests is available under the Apache License 2.0.

Languages

TypeScript

96.7%

JavaScript

3.3%