Terminating node process when using firebase within mocha tests (original) (raw)

[REQUIRED] Describe your environment

[REQUIRED] Describe the problem

Steps to reproduce:

I tried to connect to a firebase database within a mocha test, but even though I deleted the app afterwards (or even within the test) the node process is not terminating. No combination of app().delete() or database().goOffline() did work in this case.
The result is that the test runner is not able to terminate the process which means it can not be really be used within a CI environment.

It may be related to #859 but since that issue was related to auth it's possibly a different problem.

Relevant Code:

sut.js

const firebase = require('firebase/app'); require('firebase/database');

firebase.initializeApp({/* config */}); firebase.database();

module.exports = () => { firebase.app().delete(); };

sut.spec.js

const deleteFirebaseApp = require('./sut'); describe('firebase database within mocha tests', function () { it('should be able to terminate node process after deleting the firebase app', () => { deleteFirebaseApp(); }) });

Run eslint sut.spec.js afterwards to invoke the tests. Also see https://github.com/klausbayrhammer/firebase-mocha-pending-connection to reproduce the problem