Skip to content

Commit 5e4d4fb

Browse files
chore: upgrade the tests for ts-node error handling
1 parent ef45fc3 commit 5e4d4fb

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

lib/loader.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,16 @@ describe("TypeScriptLoader", () => {
5454
let stub: jest.SpyInstance<tsnode.Service, [service: tsnode.Service]>;
5555

5656
beforeEach(() => {
57-
stub = jest.spyOn(tsnode, "register").mockImplementation(() => {
58-
// eslint-disable-next-line @typescript-eslint/no-throw-literal
59-
throw unknownError;
60-
});
57+
stub = jest.spyOn(tsnode, "register").mockImplementation(
58+
() =>
59+
({
60+
compile: (): string => {
61+
// eslint-disable-next-line @typescript-eslint/no-throw-literal
62+
throw unknownError;
63+
},
64+
} as any)
65+
);
66+
loader = TypeScriptLoader();
6167
});
6268

6369
afterEach(() => {

0 commit comments

Comments
 (0)