Skip to content

Commit

Permalink
Merge pull request #25547 from storybookjs/kasper/user-event-types
Browse files Browse the repository at this point in the history
Test: Fix user event being inlined by tsup by using an interface
  • Loading branch information
kasperpeulen authored Jan 10, 2024
2 parents 54f3f21 + abb5403 commit 1fb480c
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion code/lib/test/src/testing-library.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,14 @@ export const {
prettyFormat,
} = testingLibrary;

export const { userEvent } = instrument({ userEvent: _userEvent }, { intercept: true });
// This lines below are to prevent tsup doing stupid (not working) inline stuff, see:
// https://github.com/storybookjs/storybook/issues/25258
// eslint-disable-next-line @typescript-eslint/naming-convention
type _UserEvent = typeof _userEvent;
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface UserEvent extends _UserEvent {}

export const { userEvent }: { userEvent: UserEvent } = instrument(
{ userEvent: _userEvent },
{ intercept: true }
);

0 comments on commit 1fb480c

Please sign in to comment.