Skip to content
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

submitAnalytics causing ReferenceError: trying to import a file after the Jest environment has been torn down #3608

Closed
justindi15 opened this issue Feb 22, 2021 · 3 comments · Fixed by #3634
Assignees

Comments

@justindi15
Copy link

justindi15 commented Feb 22, 2021

While running jest unit tests on both v10.2.0 and v6.1.6 I am getting the error:

ReferenceError: You are trying to import a file after the Jest environment has been torn down

I have looked through the version diffs for these releases and what is causing the error and have narrowed it down the the new analytics changes. Specifically, in lib/submit-analytics.js

Removing the 100ms timeout promise delay solves the issue. I'm wondering what was the reason for adding this?

Goals

Run jest unit tests with realm.

Expected Results

Jest unit tests to run as normally on v10.1.4 and below and v6.1.5 and below.

Actual Results

Version of Realm and Tooling

  • Realm JS SDK Version: v10.2.0 and v6.1.6
  • Node or React Native: React Native
  • Client OS & Version: RN 0.62
  • Which debugger for React Native: None
@justindi15
Copy link
Author

Seems like a regression from #3524

@fronck
Copy link

fronck commented Feb 23, 2021

@justindi15 Thanks for reporting this. I think you're right about the regression report, and we'll look into the issue.
To answer your question, the 100ms timeout is there to allow for an opt-out by setting the REALM_DISABLE_ANALYTICS env variable.

@kneth
Copy link
Contributor

kneth commented Mar 19, 2021

@justindi15 A fix has been released in v10.3.0-rc.1.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants