Skip to content

Commit 123ba75

Browse files
committed
test: cleanup test
1 parent 60855a8 commit 123ba75

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

test/normalize-options.test.js

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -596,28 +596,32 @@ describe("normalize options", () => {
596596
errored = error;
597597
}
598598

599-
if (item.throws) {
600-
expect(errored.message).toMatch(item.throws);
601-
} else {
602-
const optionsForSnapshot = klona(server.options);
599+
try {
600+
if (item.throws) {
601+
expect(errored.message).toMatch(item.throws);
602+
} else {
603+
const optionsForSnapshot = klona(server.options);
603604

604-
optionsForSnapshot.port = "<auto>";
605+
optionsForSnapshot.port = "<auto>";
605606

606-
if (optionsForSnapshot.static.length > 0) {
607-
optionsForSnapshot.static.forEach((i) => {
608-
i.directory = i.directory
609-
.replace(/\\/g, "/")
610-
.replace(
611-
new RegExp(process.cwd().replace(/\\/g, "/"), "g"),
612-
"<cwd>"
613-
);
614-
});
615-
}
607+
if (optionsForSnapshot.static.length > 0) {
608+
optionsForSnapshot.static.forEach((i) => {
609+
i.directory = i.directory
610+
.replace(/\\/g, "/")
611+
.replace(
612+
new RegExp(process.cwd().replace(/\\/g, "/"), "g"),
613+
"<cwd>"
614+
);
615+
});
616+
}
616617

617-
expect(optionsForSnapshot).toMatchSnapshot();
618+
expect(optionsForSnapshot).toMatchSnapshot();
619+
}
620+
} catch (error) {
621+
throw error;
622+
} finally {
623+
await server.stop();
618624
}
619-
620-
await server.stop();
621625
});
622626
});
623627
});

0 commit comments

Comments
 (0)