Skip to content

Quote the test globs so specs cannot be silently skipped #71

Description

@patoperpetua

Goal

Quote the src/**/*.spec.ts argument in every package test script so Node expands it, not the shell. Today the shell expands it in five of six packages, and the failure mode is silently skipped tests rather than an error.

The problem

apps/api/package.json quotes the glob correctly:

"test": "pnpm build && node --import tsx --test \"src/**/*.spec.ts\""

Every package under packages/ leaves it unquoted, so the shell expands it before Node sees it. Bash without globstar treats ** as a single *, so src/**/*.spec.ts means src/*/*.spec.tsexactly one directory deep.

It happens to work right now only because each package sits at one extreme:

  • post-kit-email has 10 nested specs and none at the top level, so shell expansion finds them all.
  • post-kit-client, -compiler, -publisher, -types each have one top-level spec and none nested. The pattern matches nothing, so bash passes the literal string through and Node's own glob resolves it correctly.

The moment any package holds specs at both depths, the shell silently wins and one set stops running:

  • Add src/anything.spec.ts to post-kit-email → the shell still matches only the 10 nested files and the new one never runs.
  • Add src/sub/anything.spec.ts to post-kit-client → the shell now matches only the nested file and src/client.spec.ts stops being executed.

Neither case errors. The suite passes, reporting fewer tests, and nothing points at the cause. AGENTS.md tells contributors to put specs next to the code, which makes hitting this a matter of time.

Scope

  • Quote the glob in the test script of all five packages under packages/, matching the form already used in apps/api.
  • Include packages/post-kit-editor if Scaffold @singleton-sd/post-kit-editor package #36 has merged.
  • Leave the rest of each script (pre-build steps, tsc -p tsconfig.spec.json) unchanged.

Constraints

  • No test files move and no test content changes.
  • Do not switch test runners or add a glob dependency; Node's --test already handles the pattern.
  • Keep every package's script shape consistent with the others.

Acceptance criteria

  • Every packages/*/package.json test script quotes the glob.
  • pnpm test at the root passes, and each package reports the same or greater number of tests than before the change.
  • A spec added at a second depth in any package is picked up — verify manually in one package with a temporary throwaway spec, confirm it runs, then remove it.
  • pnpm lint, pnpm build, and CI all pass.

Agent implementation notes

Compare against the working apps/api script. Verify by counting reported tests before and after — that count is the actual acceptance signal, not a green tick.

Branch: fix/<issue-number>-quote-test-globs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyMeets every criterion in docs/github-source-of-truth.md, section 4 — safe for an agent to claimbugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions