-
Notifications
You must be signed in to change notification settings - Fork 410
Open
Labels
Description
[READ] Step 1: Are you in the right place?
Yes
[REQUIRED] Step 2: Describe your environment
- Operating System version: MacOS Sequioa 15.7.2
- Firebase SDK version: 12.5.0
- Firebase Product: Firestore
- Node.js version: 22.19.0
- NPM version: 10.9.3
[REQUIRED] Step 3: Describe the problem
When using vi.setSystemTime() on integration tests, saving a Date to Firestore throws error.
Steps to reproduce:
- Setup Admin NodeJS SDK
- Setup Vitest & integration tests
- Use vi.setSystemTime()
- Save data containing a Date to Firestore
- Error
Error: Value for argument "data" is not a valid Firestore document. Input is not a plain JavaScript object (found in field "date").
Relevant Code:
it("date test", async () => {
vi.setSystemTime(new Date())
admin.firestore.collection("tests").doc("1").set({ date: new Date() }) // throws error
vi.useRealTimers()
})If I were to log the new Date() it will return this:
{"severity":"INFO","message":"MockDate 2025-11-27T14:51:53.132Z"}