Skip to content

Commit aaba31a

Browse files
committedAug 18, 2024·
update tests dontMock -> doUnmock
1 parent 6095160 commit aaba31a

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed
 

‎test/tests/extras.test.ts

+4-8
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,15 @@ describe(`Extra Tests`, () => {
1818
describe(`Built Tests`, () => {
1919
// see: https://github.com/LeDDGroup/typescript-transform-paths/issues/130
2020
test(`Transformer works without ts-node being present`, () => {
21-
vi.doMock(
22-
"ts-node",
23-
() => {
24-
throw new ModuleNotFoundError("ts-node");
25-
},
26-
{ virtual: true },
27-
);
21+
vi.doMock("ts-node", () => {
22+
throw new ModuleNotFoundError("ts-node");
23+
});
2824
try {
2925
const program = createTsProgram({ tsInstance: ts, tsConfigFile }, config.builtTransformerPath);
3026
const res = getEmitResultFromProgram(program);
3127
expect(res[indexFile].js).toMatch(`var _identifier_1 = require("./id")`);
3228
} finally {
33-
vi.dontMock("ts-node");
29+
vi.doUnmock("ts-node");
3430
}
3531
});
3632

‎test/tests/register.test.ts

+6-10
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,17 @@ describe(`Register script`, () => {
9191

9292
describe(`Register`, () => {
9393
test(`Throws without ts-node`, () => {
94-
vi.doMock(
95-
"ts-node",
96-
() => {
97-
throw new ModuleNotFoundError("ts-node");
98-
},
99-
{ virtual: true },
100-
);
94+
vi.doMock("ts-node", () => {
95+
throw new ModuleNotFoundError("ts-node");
96+
});
10197
expect(() => register()).toThrow(`Cannot resolve ts-node`);
102-
vi.dontMock("ts-node");
98+
vi.doUnmock("ts-node");
10399
});
104100

105101
test(`Throws if can't register ts-node`, () => {
106-
vi.doMock("ts-node", () => ({ register: () => {} }), { virtual: true });
102+
vi.doMock("ts-node", () => ({ register: () => {} }));
107103
expect(() => register()).toThrow(`Could not register ts-node instance!`);
108-
vi.dontMock("ts-node");
104+
vi.doUnmock("ts-node");
109105
});
110106

111107
test(`No transformers in tsConfig exits quietly`, () => {

0 commit comments

Comments
 (0)
Please sign in to comment.