Skip to content

Commit f51421f

Browse files
committed
refactor: import USER_EVENT_MODULE in resolve-to-testing-library-fn and update references
1 parent df09b1a commit f51421f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

lib/utils/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ const LIBRARY_MODULES = [
3131
'@marko/testing-library',
3232
] as const;
3333

34+
const USER_EVENT_MODULE = '@testing-library/user-event';
35+
3436
const SYNC_QUERIES_VARIANTS = [
3537
'getBy',
3638
'getAllBy',
@@ -151,4 +153,5 @@ export {
151153
PRESENCE_MATCHERS,
152154
ABSENCE_MATCHERS,
153155
EVENT_HANDLER_METHODS,
156+
USER_EVENT_MODULE,
154157
};

lib/utils/resolve-to-testing-library-fn.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import {
2424
isSupportedAccessor,
2525
} from '../node-utils/accessors';
2626

27-
import { LIBRARY_MODULES } from '.';
27+
import { LIBRARY_MODULES, USER_EVENT_MODULE } from '.';
2828

2929
interface ImportDetails {
3030
source: string;
@@ -152,8 +152,6 @@ interface ResolvedTestingLibraryUserEventFn {
152152
local: string;
153153
}
154154

155-
const USER_EVENT_PACKAGE = '@testing-library/user-event';
156-
157155
export const resolveToTestingLibraryFn = <
158156
TMessageIds extends string,
159157
TOptions extends readonly unknown[],
@@ -174,7 +172,7 @@ export const resolveToTestingLibraryFn = <
174172

175173
const customModuleSetting = context.settings['testing-library/utils-module'];
176174
if (
177-
[...LIBRARY_MODULES, USER_EVENT_PACKAGE, customModuleSetting].some(
175+
[...LIBRARY_MODULES, USER_EVENT_MODULE, customModuleSetting].some(
178176
(module) => module === maybeImport.source
179177
)
180178
) {

0 commit comments

Comments
 (0)