How to exit a MeteorJS program from within code?

391 views Asked by At

I need to run tests, and have them exiting the meteor process with a certain exit code, depending on success/failure. I need to do this inside Meteor.startup.

I tried process.exit(1), but only see on the console:

=> Exited with code: 1                        
=> Your application is crashing. Waiting for file change.

I need the process to actually exit with the proper exit code (for example, for acknowledging CI about unsuccessful runs).

How can I achieve this?

I don't want to use Velocity, I'm actually trying to come out with a simpler testing approach that suits my needs for a particular project.

2

There are 2 answers

0
Xolv.io On BEST ANSWER

meteor --test is a Velocity command that is built-in to Meteor. You may want to use meteor --once so that Meteor does not restart

0
Tomas Romero On

I've found a way:

Running meteor --test lets you exit from within Meteor with process.exit.