Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

268
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda