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

test: improve jest configuration #1079

Merged
merged 1 commit into from
Oct 19, 2020
Merged

test: improve jest configuration #1079

merged 1 commit into from
Oct 19, 2020

Conversation

djskinner
Copy link
Contributor

Goal

Simplify the jest testing configuration and fix the following warning in the test output:

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

      at get (node_modules/react-native/Libraries/Core/setUpXHR.js:28:30)
      at Object.getValue [as Blob] (node_modules/react-native/Libraries/Utilities/defineLazyObjectProperty.js:42:16)
          at Array.forEach (<anonymous>)

Design

Remove unnecessary configuration. Specify own minimal test setup.

Changeset

  • Removal of setUpGlobals.js and setUpXHR.js test setup for react-native tests
  • Define window in test setup, which is the only thing we used from setUpGlobals.js
  • Remove unnecessary ts configuration

Testing

Automated tests pass

@bugsnagbot
Copy link
Collaborator

@bugsnag/browser bundle size diff

Minified Minfied + Gzipped
Before 39.62 kB 12.23 kB
After 39.62 kB 12.23 kB
± No change No change

Generated by 🚫 dangerJS against b1645ce

@@ -54,8 +54,6 @@ module.exports = {
testsForPackage('plugin-react-native-session')
],
setupFiles: [
require.resolve('react-native/Libraries/Core/setUpGlobals.js'),
require.resolve('react-native/Libraries/Core/setUpXHR.js'),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

apparently i thought this was necessary for the rn integration tests 83bbb38#diff-2d0cd5d10b9604941c38c6aac608178a

but since they still pass on this branch, it seems it is not required

"node",
"jest"
],
// "types": [] /* Type declaration files to be included in compilation. */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how come these are no longer required?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm afraid I can't remember fully. I think added when I was working through the clashing of @types/react and @types/react-native

Base automatically changed from convert-tests-to-jest-3 to next October 12, 2020 11:23
@djskinner djskinner marked this pull request as ready for review October 12, 2020 12:54
@djskinner djskinner merged commit 9fe0c2f into next Oct 19, 2020
@djskinner djskinner deleted the convert-tests-to-jest-4 branch October 19, 2020 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants