DEV Community

Todd Sullivan
Todd Sullivan

Posted on

Zero-Config Test Runner: JWT Auto-Gen and No Setup Docs

Here's a thing I've built more than once: a test automation runner that works perfectly on my machine and is a complete mystery to everyone else.

The usual failure mode:

  • Private key has to live in a specific path
  • Three env vars need to be exported
  • You need to know which bundle and cloud flag to pass
  • There's a doc somewhere explaining this, probably out of date

I just fixed all of that. Here's the new interface:

./run-test.sh smoke-tests
Enter fullscreen mode Exit fullscreen mode

That's it. Optional args for tag, bundle, and cloud target if you need them. Otherwise: just works.

How it works

JWT generated at runtime. The script finds jwt-private-key.pem in the repo root (RS256, no expiry needed for test runs). No env var. No "where do I put this file" question.

JWT=$(node tools/generate-jwt.js)
Enter fullscreen mode Exit fullscreen mode

Firebase key resolved automatically. Checks the repo root first, falls back to ~/.ssh/. Works the same on a fresh clone as it does on my laptop.

const keyPath = fs.existsSync('./firebase-key.json')
  ? './firebase-key.json'
  : path.join(os.homedir(), '.ssh', 'firebase-key.json');
Enter fullscreen mode Exit fullscreen mode

One optional arg. Need to target a specific bundle or cloud env? Pass it. Otherwise the defaults are sane.

The Claude catch

Built this pairing with Claude Opus. It caught something I'd missed: my JWT generation had an expiry set that would silently break test runs longer than the token lifetime. Not a crash — just stale auth, failing tests, no obvious error.

That's the kind of thing that only shows up at 2am. Fixed it before it shipped.

Result

Any engineer can clone the repo and run tests. No setup doc. No "ask Todd what the env var is called." No onboarding friction.

Zero-config should be the default, not the goal you work toward.

Top comments (0)