Skip to content

Commit

Permalink
Await the msw server and worker
Browse files Browse the repository at this point in the history
  • Loading branch information
jwhitlock committed Feb 1, 2024
1 parent c15d0dc commit 9638cff
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions frontend/src/apiMocks/initialise.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { initialiseWorker } from "./browser";
import { initialiseServer } from "./server";

export function initialiseApiMocks() {
export async function initialiseApiMocks() {
if (typeof window === "undefined") {
const server = initialiseServer();
server.listen();
await server.listen();
} else {
const worker = initialiseWorker();
worker.start({
await worker.start({
// This custom handler supresses the default warnings about not mocking expected requests:
onUnhandledRequest: (req, print) => {
const requestUrl = new URL(req.url);
Expand Down

0 comments on commit 9638cff

Please sign in to comment.