-
Notifications
You must be signed in to change notification settings - Fork 955
Description
Operating System
Windows 11
Browser Version
No browser was used for the test
Firebase SDK Version
10.10.0
Firebase SDK Product:
Auth
Describe your project's tooling
Vue 3 app with Vite and Vitest all with typescript.
Describe the problem
After updating Firebase and changing my imports from "firebase/auth"
to "firebase/auth/web-extension"
, one of my Vitests fails.
The test is very simple and it just checks if a function returns the right strings. But the function that is being tested is in a .ts file that also imports onAuthStateChanged
from "firebase/auth/web-extension"
. This is what gives me the error; if I remove it, I don't get the error.
This is the error:
Vitest caught 1 unhandled error during the test run.
This error originated in "mytest.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
Module ...node_modules/@firebase/auth/dist/web-extension-esm2017/index.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "@firebase/auth" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
Steps and code to reproduce issue
Create a vite test in vitest called for example mytest.test.ts
with this code:
import { describe, it } from "vitest";
import { onAuthStateChanged, getAuth } from "firebase/auth/web-extension";
describe("test", () => {
it("is bad", () => {
onAuthStateChanged(getAuth(), () => {});
});
});