jeudi 26 avril 2018

Why do I have to alter the source code of firebase-functions-test in order to send the path of my private key?

The source code in index.js has this:

const lodash_1 = require("lodash");
const lifecycle_1 = require("./lifecycle");
module.exports = (firebaseConfig) => {
    const test = new lifecycle_1.FirebaseFunctionsTest();
    test.init(firebaseConfig);
    // Ensure other files get loaded after init function, since they load `firebase-functions`
    // which will issue warning if process.env.FIREBASE_CONFIG is not yet 
    set.
    let features = require('./features').features;
    features = lodash_1.merge({}, features, {
        cleanup: () => test.cleanup,
    });
    return features;
};

Now, I'm unable to get my test to work unless I alter it slightly by letting the path go through like this:

const lodash_1 = require("lodash");
const lifecycle_1 = require("./lifecycle");
module.exports = (firebaseConfig, path) => {
    const test = new lifecycle_1.FirebaseFunctionsTest();
    test.init(firebaseConfig, path);
    // Ensure other files get loaded after init function, since they load `firebase-functions`
    // which will issue warning if process.env.FIREBASE_CONFIG is not yet 
    set.
    let features = require('./features').features;
    features = lodash_1.merge({}, features, {
        cleanup: () => test.cleanup,
    });
    return features;
};

I don't think this is a bug with firebase-functions-test, because I had it working earlier, but it suddenly stopped working. This is the code I have in my test:

const test = require('firebase-functions-test')(config, './functions/test/devKey.json');

Am I doing this properly?

Aucun commentaire:

Enregistrer un commentaire