Skip to content

Commit ce4703e

Browse files
chore(test): port jest mocks to vitest
1 parent 7fcf412 commit ce4703e

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

tests/__mocks__/child_process.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* @author TheJaredWilcurt
44
*/
55

6-
const childProcess = jest.requireActual('child_process');
6+
import { vi } from "vitest";
7+
8+
const childProcess = await vi.importActual('child_process');
79

810
const childProcessMock = Object.assign({}, childProcess, {
911
execSync: jest.fn((executableAndArgs) => {

tests/__mocks__/fs.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* @author TheJaredWilcurt
44
*/
55

6-
const fs = jest.requireActual('fs');
6+
import { vi } from "vitest";
7+
8+
const fs = await vi.importActual('fs');
79

810
const fsMock = Object.assign({}, fs, {
911
writeFileSync: jest.fn((file) => {

tests/__mocks__/os.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* @author TheJaredWilcurt
44
*/
55

6-
const os = jest.requireActual('os');
6+
import { vi } from "vitest";
7+
8+
const os = await vi.importActual('os');
79

810
const osMock = Object.assign({}, os, {
911
homedir: function () {

tests/__mocks__/path.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@
33
* @author TheJaredWilcurt
44
*/
55

6-
const path = jest.requireActual('path');
6+
import { vi } from "vitest";
7+
8+
const path = await vi.importActual('path');
79

810
const pathMock = Object.assign({}, path, {
911
sep: '/'

0 commit comments

Comments
 (0)