Yes, I can run process.exit() or --exit with my mocha tests, but that seems wrong.
I've got firebase-admin in some code that I'm maintaining and I'm trying to run mocha tests, but according to wtfnode:
wtfnode node_modules/.bin/_mocha --compilers coffee:coffee-script/register
Firebase is responsible for holding my process open:
- Timers:
- (3300000 ~ 55 min) (anonymous) @ /home/wayne/programming/universe/library/server/node_modu
les/firebase-admin/lib/firebase-app.js:147
- Intervals:
- (45000 ~ 45 s) (anonymous) @ /home/wayne/programming/universe/library/server/node_modules/
firebase-admin/lib/database/database.js:199
Thanks a lot, Firebase. This is frustrating. I can fix the database part:
db = app.database();
db.goOffline();
Boom. Done. Now I just see the timer that won't die.How do I kill that? I've tried looking at that source code, which points me to this little spot:
FirebaseAppInternals.prototype.setTokenRefreshTimeout = function (delayInMilliseconds, numRetries) {
var _this = this;
this.tokenRefreshTimeout_ = setTimeout(function () {
_this.getToken(/* forceRefresh */ true)
.catch(function (error) {
// Ignore the error since this might just be an intermittent failure. If we really cannot
// refresh the token, an error will be logged once the existing token expires and we try
// to fetch a fresh one.
if (numRetries > 0) {
_this.setTokenRefreshTimeout(60 * 1000, numRetries - 1);
}
});
}, delayInMilliseconds);
};
Unfortunately, I'm not sure how to get that tokenRefreshTimeout_ so I can cancelTimer.
Is there a way to tell firebase-admin that I'm done and it really needs to stop now, or am I stuck with --exit?