From 4335051721ea0d6a1de8ccce4dca36163cba19e0 Mon Sep 17 00:00:00 2001 From: Yuki Hattori Date: Mon, 16 Sep 2024 04:35:53 +0900 Subject: [PATCH] Fix using invalid filename on Windows --- test/__mocks__/{node:fs.ts => node/fs.ts} | 0 test/__mocks__/{node:path.ts => node/path.ts} | 0 test/converter.ts | 2 +- test/marp-cli.ts | 2 +- test/preview.ts | 2 +- 5 files changed, 3 insertions(+), 3 deletions(-) rename test/__mocks__/{node:fs.ts => node/fs.ts} (100%) rename test/__mocks__/{node:path.ts => node/path.ts} (100%) diff --git a/test/__mocks__/node:fs.ts b/test/__mocks__/node/fs.ts similarity index 100% rename from test/__mocks__/node:fs.ts rename to test/__mocks__/node/fs.ts diff --git a/test/__mocks__/node:path.ts b/test/__mocks__/node/path.ts similarity index 100% rename from test/__mocks__/node:path.ts rename to test/__mocks__/node/path.ts diff --git a/test/converter.ts b/test/converter.ts index db1619f3..f7f392aa 100644 --- a/test/converter.ts +++ b/test/converter.ts @@ -22,7 +22,7 @@ const puppeteerTimeoutMs = 60000 let mkdirSpy: jest.SpiedFunction -jest.mock('node:fs') +jest.mock('node:fs', () => require('./__mocks__/node/fs')) beforeEach(() => { mkdirSpy = jest.spyOn(fs.promises, 'mkdir').mockImplementation() diff --git a/test/marp-cli.ts b/test/marp-cli.ts index d1b0f3e5..2d247779 100644 --- a/test/marp-cli.ts +++ b/test/marp-cli.ts @@ -39,7 +39,7 @@ const runForObservation = async (argv: string[]) => { } jest.mock('cosmiconfig') -jest.mock('node:fs') +jest.mock('node:fs', () => require('./__mocks__/node/fs')) jest.mock('../src/preview') jest.mock('../src/watcher', () => jest.createMockFromModule('../src/watcher')) diff --git a/test/preview.ts b/test/preview.ts index 23348946..24f13f2c 100644 --- a/test/preview.ts +++ b/test/preview.ts @@ -4,7 +4,7 @@ import { CLIError } from '../src/error' import { File, FileType } from '../src/file' import { Preview, fileToURI } from '../src/preview' -jest.mock('node:path') +jest.mock('node:path', () => require('./__mocks__/node/path')) jest.setTimeout(40000) describe('Preview', () => {