3

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?

The Qodesmith
  • 3,205
  • 4
  • 32
  • 45

1 Answers1

3

it's possible that your npm run test command is not returning a proper error code of non-zero

rob2d
  • 964
  • 9
  • 16