Skip to content

Run the tests before publishing - #10

Merged
rahmanow merged 1 commit into
masterfrom
claude/repo-setup-features-sv89xo
Aug 28, 2026
Merged

Run the tests before publishing#10
rahmanow merged 1 commit into
masterfrom
claude/repo-setup-features-sv89xo

Conversation

@rahmanow

Copy link
Copy Markdown
Owner

Adds a prepublishOnly guard so npm publish fails rather than ships a broken build.

"prepublishOnly": "npm test"

Verified, not assumed

A guard that does not actually block is worse than none, so I checked all three behaviours it needs:

Behaviour Result
Runs on npm publish > shadowtools@4.0.0 prepublishOnlynpm test# pass 62
Aborts the publish when a test fails Added a deliberately failing test: npm error code 1, exit 1, nothing published
Does not block npm pack Tarball still builds — packing is not publishing

The temporary failing test was removed afterwards; the suite is back to 62 passing.

Why it is worth the one line

The package is about to go to npm for the first time. Publishing is close to irreversible — npm restricts unpublishing after 72 hours and the name stays claimed either way — so the cost of shipping a broken version is much higher than for a normal commit. CI already covers pushes and pull requests, but nothing stood between a local working copy and the registry.


Generated by Claude Code

A prepublishOnly script makes npm publish fail rather than ship a broken
build. Verified all three ways it needs to behave: it runs on publish,
it aborts the publish with a non-zero exit when a test fails, and it
leaves npm pack alone, since packing is not publishing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJR2DDBimsijgYgZS3bUS8
@rahmanow
rahmanow merged commit 56f77ff into master Aug 28, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants