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: Fix user event being inlined by tsup by using an interface #25547

Merged
merged 1 commit into from
Jan 10, 2024

Conversation

kasperpeulen
Copy link
Contributor

Fixes #25258

What I did

Fix user event being inlined by tsup by using an interface

Checklist for Contributors

Testing

The changes in this PR are covered in the following automated tests:

  • stories
  • unit tests
  • integration tests
  • end-to-end tests

Manual testing

This section is mandatory for all contributions. If you believe no manual test is necessary, please state so explicitly. Thanks!

Documentation

  • Add or update documentation reflecting your changes
  • If you are deprecating/removing a feature, make sure to update
    MIGRATION.MD

Checklist for Maintainers

  • When this PR is ready for testing, make sure to add ci:normal, ci:merged or ci:daily GH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found in code/lib/cli/src/sandbox-templates.ts

  • Make sure this PR contains one of the labels below:

    Available labels
    • bug: Internal changes that fixes incorrect behavior.
    • maintenance: User-facing maintenance tasks.
    • dependencies: Upgrading (sometimes downgrading) dependencies.
    • build: Internal-facing build tooling & test updates. Will not show up in release changelog.
    • cleanup: Minor cleanup style change. Will not show up in release changelog.
    • documentation: Documentation only changes. Will not show up in release changelog.
    • feature request: Introducing a new feature.
    • BREAKING CHANGE: Changes that break compatibility in some way with current major version.
    • other: Changes that don't fit in the above categories.

🦋 Canary release

This PR does not have a canary release associated. You can request a canary release of this pull request by mentioning the @storybookjs/core team here.

core team members can create a canary release here or locally with gh workflow run --repo storybookjs/storybook canary-release-pr.yml --field pr=<PR_NUMBER>

@kasperpeulen kasperpeulen removed the maintenance User-facing maintenance tasks label Jan 10, 2024
@kasperpeulen kasperpeulen merged commit 1fb480c into next Jan 10, 2024
67 of 77 checks passed
@kasperpeulen kasperpeulen deleted the kasper/user-event-types branch January 10, 2024 15:37
@github-actions github-actions bot mentioned this pull request Jan 10, 2024
27 tasks
@skratchdot
Copy link

@kasperpeulen - i had to manually override the version of userEvent my repo is using for these changes to take effect. I'm not sure why.

I am using 8.0.0-alpha.10, and I need:

  "pnpm": {
    "overrides": {
      "@testing-library/user-event": "^14.5.2"
    }
  }

or else I see errors like:

 error  Unsafe call of an `any` typed value  @typescript-eslint/no-unsafe-call

So I see errors with this:

@storybook/test 8.0.0-alpha.10
└── @testing-library/user-event 14.3.0

But no errors with:

@storybook/test 8.0.0-alpha.10
└── @testing-library/user-event 14.5.2

I think we downgraded and pinned userEvent here:
#25004

I use firefox as my primary browser and haven't ran into that issue (that I'm aware of).

Any chance we can update the whole repo so every userEvent is using:

"@testing-library/user-event": "^14.5.2"

I can submit a PR for that if we are okay with it.

@kasperpeulen
Copy link
Contributor Author

cc @tmeasday We might need to reconsider that PR indeed, as we can not stay on 14.3.0 forever.

We could also make a FAQ about to reconcile those firefox issues listed here:
testing-library/user-event#1075

@IanVS
Copy link
Member

IanVS commented Jan 24, 2024

FWIW several of my stories also broke when upgrading from 7.6.0 to 7.6.1, and I tried overriding the version of user-event in my package.json but of course I couldn't because it's pre-bundled. :(

@tmeasday
Copy link
Member

@kasperpeulen is there a workaround for FF users by tweaking their play function or similar?

@kasperpeulen
Copy link
Contributor Author

I belief there are some workarounds indeed, but it is not pretty:
testing-library/user-event#1075 (comment)

Shall I try to make a canary, and see if I can make a workaround for all the issues we found in our internal codebases, and see if the workaround is acceptable? cc @shilman

@shilman
Copy link
Member

shilman commented Jan 29, 2024

@kasperpeulen SGTM

@kasperpeulen
Copy link
Contributor Author

@shilman @vanessayuenn added it to the storybook 8.0 project:
#25853

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: @storybook/test exports any types for userEvent
5 participants