Skip to content

Commit 302c377

Browse files
committed
update tests dontMock -> doUnmock
1 parent 0e4bf33 commit 302c377

File tree

2 files changed

+10
-18
lines changed

2 files changed

+10
-18
lines changed

Diff for: 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

Diff for: test/tests/register.test.ts

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

9090
describe(`Register`, () => {
9191
test(`Throws without ts-node`, () => {
92-
vi.doMock(
93-
"ts-node",
94-
() => {
95-
throw new ModuleNotFoundError("ts-node");
96-
},
97-
{ virtual: true },
98-
);
92+
vi.doMock("ts-node", () => {
93+
throw new ModuleNotFoundError("ts-node");
94+
});
9995
expect(() => register()).toThrow(`Cannot resolve ts-node`);
100-
vi.dontMock("ts-node");
96+
vi.doUnmock("ts-node");
10197
});
10298

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

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

0 commit comments

Comments
 (0)