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

fix(react-test-utils): fix remaining integration issues #109

Merged
merged 16 commits into from
Sep 17, 2024

Conversation

sjwilczynski
Copy link
Contributor

@sjwilczynski sjwilczynski commented Sep 16, 2024

In #108 we partially fixed some issues, as imports still not work correctly due to wrong imports map and there was an error thrown when opening storybook on jest being used directly. Here we aim to fix these by:

  • upgrading typescript to 5.x to be able to use moduleResolution: "Bundler' needed for exports map (apart from compiler which needs to stay on 4.x) - this also required bumping @graphitation dependencies and making sure we can use per package tsconfig for tests
  • correctly use exports map as it's used by various tools but keep the additional .mjs/.d.ts/.js files to not force consumers to use moduleResolution bundler
  • replace @jest/globals with @jest/types to avoid runtime issues in storybook

Verified changes using local storybook and by making a patch in 1JS

@sjwilczynski sjwilczynski marked this pull request as ready for review September 17, 2024 11:27
@sjwilczynski sjwilczynski enabled auto-merge (squash) September 17, 2024 11:39
@sjwilczynski sjwilczynski enabled auto-merge (squash) September 17, 2024 12:48
@@ -19,3 +19,5 @@ Then inside your package.json add the compiler to your `scripts`:
}
}
```

Copy link
Contributor

Choose a reason for hiding this comment

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

This sounds like something we should fix?

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 agree but who has funding to fix it? I created an issue a while back in microsoft/graphitation#331

{
"extends": "./tsconfig.json",
"compilerOptions": {
"noUnusedLocals": false,
Copy link
Contributor

Choose a reason for hiding this comment

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

// prevents error about graphql import not being used when artifacts are loaded

This looks like it moved from further down, where it had this comment? Is this the reason this is being added here? Should we include the comment?

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 realized it makes more sense to have local test specific tsconfigs, instead of using a big one. I will make a small PR to improve it even further and add some explanations

@sjwilczynski sjwilczynski merged commit 37d880d into microsoft:main Sep 17, 2024
2 checks passed
@sjwilczynski sjwilczynski deleted the user/stwilczy/fixJest branch September 18, 2024 09:55
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.

2 participants