mercredi 28 août 2019

NPM - how to publish only if tests pass?

I have tests setup for a package I maintain - create-new-app. When I run npm publish, I want the tests to run first and only if they pass, move on to the publish portion. I thought this is what prepublishOnly was for. My prepublishOnly value looks like this:

prepublishOnly: "npm run test"

That successfully runs the tests prior to publishing, but if the tests fail, it still publishes! How can I get the publish to happen only when tests pass?

Aucun commentaire:

Enregistrer un commentaire