Skip to content

Firestore: local_store_indexeddb.test.ts: fix spurious errors on test cleanup #7922

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

dconeybe
Copy link
Contributor

@dconeybe dconeybe commented Jan 5, 2024

Fix some spurious test failures that get reported if some of the "before" actions of a test fail. Specifically, calling

persistence.shutdown()

would throw a

Uncaught TypeError: Cannot read properties of undefined

error if the "before" step that initialized the persistence variable failed before setting it.

Although this isn't a problem, it adds noise to a test failure that may already be difficult enough to debug.

The fix is simple: just conditionally call the method only if the object is defined; that is, change it to

persistence?.shutdown()

…lling persistence.shutdown() after a setup failure.
@dconeybe dconeybe self-assigned this Jan 5, 2024
Copy link

changeset-bot bot commented Jan 5, 2024

⚠️ No Changeset found

Latest commit: b419a7f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@google-oss-bot
Copy link
Contributor

@google-oss-bot
Copy link
Contributor

@dconeybe dconeybe requested a review from milaGGL January 5, 2024 21:11
@dconeybe dconeybe marked this pull request as ready for review January 5, 2024 21:11
@dconeybe dconeybe requested review from a team as code owners January 5, 2024 21:11
@dconeybe dconeybe merged commit 6ea51fb into master Jan 5, 2024
@dconeybe dconeybe deleted the dconeybe/AwaitPersistenceShutdownInTestConditionally branch January 5, 2024 23:46
@firebase firebase locked and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants