Closed epall closed 3 years ago
It appears that functions.logger, documented at https://firebase.google.com/docs/functions/writing-and-viewing-logs, is missing from firebase-functions-test.
functions.logger
firebase-functions-test
firebase-functions-test: 0.1.7
firebase-functions: 3.3.0
firebase-admin: 8.9.1
/* index.js */ const functions = require('firebase-functions'); exports.myFunc = functions .firestore .document('quotes/{quoteId}') .onUpdate(async ({before, after}) => { functions.logger.info("Hello, world!"); } /* index.test.js */ const myFunctions = require('../index'); const test = require('firebase-functions-test')(firebaseConfig, 'XXX'); describe("myFunc", () => { const myFunc = test.wrap(myFunctions.myFunc); myFunc(); });
index.test.js
Nothing happens, it executes successfully.
TypeError: Cannot read property 'info' of undefined at Function.exports.sendReadyNotification.functions.firestore.document.onUpdate [as run] (index.js:253:24)
Turns out I had an outdated version of firebase-functions that was missing logger.
firebase-functions
logger
It appears that
functions.logger
, documented at https://firebase.google.com/docs/functions/writing-and-viewing-logs, is missing fromfirebase-functions-test
.Version info
firebase-functions-test: 0.1.7
firebase-functions: 3.3.0
firebase-admin: 8.9.1
Test case
Steps to reproduce
index.test.js
Expected behavior
Nothing happens, it executes successfully.
Actual behavior