When running all my tests together, the makeDocumentSnapshot call gives error SyntaxError: Unexpected token u in JSON at position 0 at firebase-functions-test/lib/app.js:41:65, which is basically that process.env.FIREBASE_CONFIG being undefined. However, if I just run the test individually, it passes.
My file structure
src |-- foo |-- index.ts |-- foo.ts |-- index.ts test |-- test.ts |-- foo |-- foo.test.ts package.json { "test": "mocha -r ts-node/register test/**/*.test.ts" } // index.ts import * as admin from 'firebase-admin'; admin.initializeApp(); admin.firestore().settings({ ignoreUndefinedProperties: true }); export * as foo from './foo/index'; // test.ts import Test from 'firebase-functions-test'; export default Test({ databaseURL, storageBucket, projectId }, 'test/service-account-key.json'); // foo.test.ts import test from '../test'; import * as myFunctions from '../../src/index'; describe('foo()', () => { const wrapped = test.wrap(myFunctions.foo.foo); it ('should do this', async () => { // This line gives error when running all tests together, // but not when running this test individually with // describe.only(). const snapshot = test.firestore.makeDocumentSnapshot(...) ... }); });