Skip to content

Commit ac2030f

Browse files
committed
Fix msw test runner integration
1 parent b4ed644 commit ac2030f

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

src/Umbraco.Web.UI.Client/web-test-runner.config.mjs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -64,19 +64,22 @@ export default {
6464
window.__UMBRACO_TEST_RUN_A11Y_TEST = ${(!devMode).toString()};
6565
</script>
6666
<script src="/node_modules/msw/lib/iife/index.js"></script>
67-
<script type="module" src="/web-test-runner.index.ts"></script>
6867
<link rel="stylesheet" href="node_modules/@umbraco-ui/uui-css/dist/uui-css.css">
6968
<link rel="stylesheet" href="src/css/umb-css.css">
7069
<script type="module">
71-
import '@umbraco-cms/backoffice/components';
70+
// Initialize MSW first and wait for it to be ready before loading tests
71+
await import('/web-test-runner.index.ts');
72+
73+
// Now load the rest of the modules
74+
await import('@umbraco-cms/backoffice/components');
75+
await import('element-internals-polyfill');
76+
await import('@umbraco-ui/uui');
77+
78+
// Finally load the test framework
79+
await import('${testFramework}');
7280
</script>
7381
</head>
7482
<body>
75-
<script type="module" src="${testFramework}"></script>
76-
<script type="module">
77-
import 'element-internals-polyfill';
78-
import '@umbraco-ui/uui';
79-
</script>
8083
</body>
8184
</html>`,
8285
};

src/Umbraco.Web.UI.Client/web-test-runner.index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { onUnhandledRequest, setupWorker } from './src/mocks/index.js';
33

44
const worker = setupWorker(...handlers);
55

6-
worker.start({
6+
await worker.start({
77
onUnhandledRequest,
88
quiet: true,
99
});

0 commit comments

Comments
 (0)