Hollow Test Guard: Tests That Can Actually Fail

    1

    Tests that fail when the code breaks: a checklist and rewrite rules for the hollow-test patterns found even in popular open source projects.

    Free

    Security scanned

    Works with the AI Agents you already use

    Claude CodeClaude CodeCursorCursorCodex CLICodex CLIDeepSeekDeepSeekMuseMuse+22 more

    Hollow Test Guard: Tests That Can Actually Fail

    Example session with this skill installed

    Review this test file and tell me which tests can never fail: it("adds", () => { add(1,2) }); it("is null", () => { expect(find()).toBeNull }); it("loads", async () => { expect(load()).resolves.toBe(1) }); it("throws", () => { try { parse("") } catch (e) { expect(e.message).toBe("empty") } }); it("sums", () => { expect(add(2,2)).toBe(4) });

    • Read your context and instructions
    • Compiled the hollow test guard

    Four of the five tests are weak. Three can effectively never fail on a wrong result, and one fails only in some cases.

    Can never fail on a wrong result

    1. adds has no assertion. It passes unless add throws, so add(1,2) returning 99 still passes.

    is null writes toBeNull without parentheses. That only reads the matcher function and never calls it, so nothing is asserted. It passes whatever find() returns. The fix is toBeNull().
    3.

    loads neither awaits nor returns the .resolves assertion. The test finishes before the promise settles, so a wrong value or a rejection never fails it. Depending on the runner, it may show up later as an unhandled rejection or be swallowed. The fix is await expect(load()).resolves.toBe(1).

    Can fail, but not in the main failure case

    throws passes silently if parse("") doesn't throw, because the expect lives only in the catch. That is the main regression it should catch. It does fail if the error has a different message. The fix is expect(() => parse("")).toThrow("empty"), or add expect.assertions(1).

    Fine

    1. sums calls add(2,2) and asserts toBe(4), so it fails if add is wrong.

    One more point: adds and sums test the same function. adds should assert expect(add(1,2)).toBe(3) or be deleted.

    Real output from a Claude Code session with this skill installed.

    Connects securely to your tools. The creator never sees your data.

    About this skill

    Tests that pass while the code is broken provide a false sense of security. This skill identifies and fixes "hollow tests"—assertions that can never fail due to missing awaits, swallowed exceptions, or tautological comparisons. It helps your test suite guard against regressions instead of just inflating coverage metrics.

    What it does

    • Flags hollow patterns like un-awaited async assertions, assertions inside empty catch blocks, and calls to matchers without parentheses.
    • Identifies tautologies where tests compare a variable to itself or a constant, ensuring assertions remain meaningful.
    • Detects swallowed errors in Python and JavaScript where try/except or try/catch blocks inadvertently hide assertion failures.
    • Fixes weak assertions by suggesting specific value checks over generic toBeTruthy or toBeDefined calls.
    • Audits mocks to ensure you are testing the actual logic rather than mocking the module under test itself.

    How it works

    1. Analyze test files by providing the content of a spec or test file for review.
    2. Review output generated for each finding, including the file line, test name, the hollow pattern detected, and why it fails to protect the code.
    3. Apply concrete rewrites based on the provided fixes to turn hollow tests into functional guards.

    Frameworks & tools

    Supports JavaScript and TypeScript using Jest, Vitest, Mocha, node:test, Playwright, and Testing Library. Supports Python using pytest and unittest.

    Why this beats prompting it yourself

    Hollow tests look fine at a glance, which is why they survive code review even in well-maintained open source projects. This skill gives your agent a codified list of those anti-patterns to catch specific technical debt that generic prompts miss, such as the difference between expect(x).toBeNull and expect(x).toBeNull().

    Use cases

    • Reviewing a pull request to ensure new tests actually validate the behavior.
    • Troubleshooting a test that stays green even when you manually break the source code.
    • Refactoring legacy test suites that rely heavily on generic snapshots or weak assertions.

    Known limitations

    Does not flag type-level tests, property-based tests, or explicit smoke tests intended only to verify a function does not throw. Requires manual verification of the suggested "correct" value.

    Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Testing & Debugging.

    Does not flag type-level tests, property-based tests, or explicit smoke tests. Requires manual verification of the suggested correct value.

    How to use

    1. 1

      Connect your agent to the Agensi MCP

      Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup

    2. 2

      Sign in to Agensi

      Your agent shows a sign-in link. Sign in and click Allow.

    3. 3

      Ask for what you need

      Your agent loads this skill and uses it on your task. It always asks before buying a skill.

    Reviews

    No reviews yet

    Be one of the first to try it. Every listed skill goes through the trust checks below.

    Security scanned

    Checked by our 8-point scan before listing

    Fresh listing

    Recently published to Agensi

    Free to use

    No account required to browse

    Trust & safety

    Security scan

    Security scan passed 16 days ago

    • Free with an Agensi account

    Software
    hollowtestNode.js

    Permissions

    Read Files
    Listed16 days ago

    What's inside

    Frequently Asked Questions

    This skill detects tests that pass despite the code being broken, such as missing 'await' keywords in async tests, tautological assertions, and swallowed exceptions in try/catch blocks.

    Yes, it supports JavaScript and TypeScript (Jest, Vitest, Mocha, Playwright, node:test) as well as Python (pytest, unittest), making it versatile for full-stack environments.

    It gives your agent a concrete checklist of patterns that make a test unable to fail, with the rewrite for each, plus the rule never to make a red test green by weakening it. That turns "looks tested" into something you can check line by line.

    The skill provides a detailed audit report for each test file, including the specific line number, the reason the test is hollow, and a concrete code rewrite to fix the issue.

    It covers unit and integration tests in JS/TS and Python. Type-level tests (expectTypeOf, tsd-style checks, @ts-expect-error), property-based tests and explicit smoke tests are recognized and not flagged as hollow.

    New in Testing & Debugging

    Free