Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: loader tests error on windows #6508

Merged
merged 1 commit into from
May 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions test/loader/load.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import fs from 'fs'
import path from 'path'
import { fileURLToPath } from 'url'
import { fileURLToPath, pathToFileURL } from 'url'
const filename = fileURLToPath(import.meta.url)
const dirname = path.dirname(filename)

Expand All @@ -17,8 +17,7 @@ export const load = async (filePath) => {
'Looks like payload has not been built. Please run `pnpm build:core` in the monorepo root',
)
}

const importConfigImport = await import(resolvedImportWithoutClientFilesPath)
const importConfigImport = await import(pathToFileURL(resolvedImportWithoutClientFilesPath).href)
const importConfig = importConfigImport.importConfig

const result = await importConfig(filePath)
Expand Down
8 changes: 4 additions & 4 deletions test/loader/startChildProcess.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { spawn } from 'node:child_process'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'
import { fileURLToPath, pathToFileURL } from 'node:url'
import path from 'path'

const _filename = fileURLToPath(import.meta.url)
Expand All @@ -9,12 +9,12 @@ const _dirname = dirname(_filename)
export const startChildProcess = async (filePath: string): Promise<number> => {
return new Promise<number>((res) => {
const childProcess = spawn('node', [path.resolve(_dirname, 'init.js')], {
stdio: 'inherit',
env: {
PATH: process.env.PATH,
NODE_ENV: 'development',
LOADER_TEST_FILE_PATH: filePath,
NODE_ENV: 'development',
PATH: process.env.PATH,
},
stdio: 'inherit',
})

childProcess.on('close', (code) => {
Expand Down
Loading