Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
Firebase offline unit testing: Could not load the default credentials

I am trying to write some unit-tests using the firebase-emulator. No matter what I do, it always gives me this error:

Could not load the default credentials. Browse to https://cloud.google.com/docs/authentication/getting-started for more information.

Test

describe('Cloud Functions', function() {
    let myFunctions: any, adminInitStub: sinon.SinonStub<[options?: admin.AppOptions, name?: string], admin.app.App>;
    const tester = funcTest();

    before(async () => {
        admin.initializeApp();
        adminInitStub = sinon.stub(admin, "initializeApp");
        myFunctions = await import("../src/index")
    });
  
    after(() => {
        adminInitStub.restore();
        tester.cleanup();
    });

    describe("dbOrderServiceOnCreated", () => {

        it("should add snapshot successfully", async function() {
            const wrapped = tester.wrap(myFunctions.dbOrderServiceOnCreated)
            
            wrapped(serviceOrderSnap)
            this.timeout(0);

            // THIS IS THE PROBLEM
            const value = await admin.firestore().collection(constants.collectionOrdersService).get(); 
            return chai.assert.equal(value.size, 1);
        })
    })
})
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!