firebase-functions-test
firebase-functions-test copied to clipboard
Update Dependency to Firebase Functions v6
Version info
firebase-functions-test: 3.3.0
firebase-functions: 6.X
firebase-admin: 12.5.0
Test case
Upgrade Firebase Functions to 6.0 (Contains breaking change)
Tests won't pass anymore
Because the latest version changed the default entrypoint, imports of this library need to be rewritten to point to their v1 versions.
This is the error I'm getting:
TypeError: Cannot read properties of undefined (reading 'userRecordConstructor')
at Object.makeUserRecord (node_modules/firebase-functions-test/lib/providers/auth.js:30:38)
at mockCustomer (test/helpers/customers.ts:10:47)
at Context.<anonymous> (test/purchases/handlers/savePurchase.spec.ts:11:38)
at processImmediate (node:internal/timers:478:21)
at process.callbackTrampoline (node:internal/async_hooks:130:17)
When i try to create a user:
const userRecord: UserRecord = testEnv.auth.makeUserRecord({
email: customer.email,
displayName: customer.displayName,
uid: userUid,
});
Oh no, we are migrating Firebase Functions to 6.0 and our cloud functions to V2 and this is breaking our tests
I created this PR that maybe should fix it: https://github.com/firebase/firebase-functions-test/pull/243
I don't exactly know what I'm doing, but I had to make similar changes in my own repo, so maybe it's this simple.
It's been a couple of months with no response here. There's even a PR listed. Is there anyone working on this project or should we consider it abandoned?
@EnduringBeta would you be willing to publish your fork under a namespace so that people can use that in the meantime?
@EnduringBeta would you be willing to publish your fork under a namespace so that people can use that in the meantime?
Sorry for the delay. I haven't done that before for this purpose.
I merged my PR into my own fork, so it's on master here: https://github.com/EnduringBeta/firebase-functions-test
Is that what's needed, and then y'all update your pubspec.yaml to point to this repo and branch?
@EnduringBeta Actually I was hoping for an NPM package :sweat_smile: or maybe figuring some way to have the lib directory published in the git repo, since package.json references that directory. That way, people could either point their package.json at your repo URL directly, or run npm install @enduringbeta@firebase-functions-test to get the built version from NPM.
I imagine adding a namespace to the package name in package.json (e.g. @enduringbeta@firebase-functions-test) and running ./scripts/publish.sh would do the trick.
I think pubspec.yaml is a Dart thing, so wouldn't work for a Node project..
@EnduringBeta Actually I was hoping for an NPM package 😅 or maybe figuring some way to have the
libdirectory published in the git repo, sincepackage.jsonreferences that directory. That way, people could either point their package.json at your repo URL directly, or runnpm install @enduringbeta@firebase-functions-testto get the built version from NPM.I imagine adding a namespace to the package name in
package.json(e.g.@enduringbeta@firebase-functions-test) and running./scripts/publish.shwould do the trick.
Thanks for this guidance and your patience. I will do my best to accomplish this soon, but it's a busy time for me and I haven't done this before.
And yeah, I use this in combo with my Flutter/Dart project, so I lost sight of this needing to be for NPM/package.json.
For anyone that still needs this, I used @EnduringBeta 's branch and added the 'lib' folder to it so that it can be used.
I use this line on my package.json:
"firebase-functions-test": "github:Nushio/firebase-functions-test",
I mean to take no credit for this, just putting it out there so others can continue testing the functions before deploying :)
I just heard from our Google Cloud Support contact. They are working on merging the PRs. They just need to resolve some legalese.
@EnduringBeta you may have to sign their standard contributor license agreements first, once that's setup ☺️
I just heard from our Google Cloud Support contact. They are working on merging the PRs. They just need to resolve some legalese.
@EnduringBeta you may have to sign their standard contributor license agreements first, once that's setup ☺️
I believe I've signed one of those for Google before. I'm not sure if there are multiple for different products.
Thanks for the update. I'll await notice here for any further steps.