diff --git a/tests/commands/api/generate.test.ts b/tests/commands/api/generate.test.ts index b1fbb67d..f37d16a0 100644 --- a/tests/commands/api/generate.test.ts +++ b/tests/commands/api/generate.test.ts @@ -1,6 +1,6 @@ import { execSync } from 'child_process' import fs from 'fs-extra' -import path from 'path' +import { pathToFileURL } from 'node:url' import os from 'os' let ENV_VAR = 'SITES_DIR=tests/__data__/input/epg-grab/sites API_DIR=tests/__data__/output' @@ -26,7 +26,7 @@ describe('api:generate', () => { }) function content(filepath: string) { - return fs.readFileSync(path.resolve(filepath), { + return fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' }) } diff --git a/tests/commands/channels/editor.test.ts b/tests/commands/channels/editor.test.ts index b3a6a13f..3d5ab81a 100644 --- a/tests/commands/channels/editor.test.ts +++ b/tests/commands/channels/editor.test.ts @@ -1,7 +1,7 @@ import fs from 'fs-extra' import { execSync } from 'child_process' import os from 'os' -import path from 'path' +import { pathToFileURL } from 'node:url' type ExecError = { status: number @@ -46,7 +46,7 @@ describe('channels:editor', () => { }) function content(filepath: string) { - return fs.readFileSync(path.resolve(filepath), { + return fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' }) } diff --git a/tests/commands/channels/parse.test.ts b/tests/commands/channels/parse.test.ts index 3f52de37..24ed5a22 100644 --- a/tests/commands/channels/parse.test.ts +++ b/tests/commands/channels/parse.test.ts @@ -1,6 +1,6 @@ import { execSync } from 'child_process' import fs from 'fs-extra' -import path from 'path' +import { pathToFileURL } from 'node:url' beforeEach(() => { fs.emptyDirSync('tests/__data__/output') @@ -24,7 +24,7 @@ describe('channels:parse', () => { }) function content(filepath: string) { - return fs.readFileSync(path.resolve(filepath), { + return fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' }) } diff --git a/tests/commands/epg/grab.test.ts b/tests/commands/epg/grab.test.ts index c28257f9..4786a93a 100644 --- a/tests/commands/epg/grab.test.ts +++ b/tests/commands/epg/grab.test.ts @@ -1,5 +1,6 @@ import { execSync } from 'child_process' import fs from 'fs-extra' +import { pathToFileURL } from 'node:url' import path from 'path' import os from 'os' import { Zip } from '@freearhey/core' @@ -99,7 +100,7 @@ describe('epg:grab', () => { }) function content(filepath: string) { - return fs.readFileSync(path.resolve(filepath), { + return fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' }) } diff --git a/tests/commands/sites/update.test.ts b/tests/commands/sites/update.test.ts index 5ce106b8..3446e28d 100644 --- a/tests/commands/sites/update.test.ts +++ b/tests/commands/sites/update.test.ts @@ -1,6 +1,6 @@ import { execSync } from 'child_process' import fs from 'fs-extra' -import path from 'path' +import { pathToFileURL } from 'node:url' import os from 'os' beforeEach(() => { @@ -35,7 +35,7 @@ it('can update SITES.md', () => { }) function content(filepath: string) { - const data = fs.readFileSync(path.resolve(filepath), { + const data = fs.readFileSync(pathToFileURL(filepath), { encoding: 'utf8' })