Native Dev
Native Dev

Reputation: 7402

Fail/terminate node.js process if Mithril Ospec tests fail

When I run unit tests via Ospec for Mithril, I can see if tests fail locally in the console.

What I'm looking for is a solution that will not allow a following Node.js build script to execute if one or more of the tests fail.

I don't want code to be pushed up to another environment/lane if the unit tests aren't passing.

I don't see how to accomplish this in the docs.

In Node, I'm running ospec && someBuildProcess.

The answer might be a Node.js thing, but I'm at a loss for what to look for now.

Upvotes: 0

Views: 55

Answers (1)

Tivac
Tivac

Reputation: 2573

ospec calls process.exit(1) if any tests fail, and the command string you posted should work. I just verified it locally with the following setup:

https://gist.github.com/tivac/d90c07592e70395639c63dd5100b50a6

ospec runs, fails, and the echo command never gets called.

Can you post some more details about your setup?

Upvotes: 1

Related Questions