Skip to content

Commit 9542ec2

Browse files
committed
fix(windows): use pathToFileURL to read middleware in Windows
1 parent 4b47ccb commit 9542ec2

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

bin/command.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { buildBrowserFromString } from "../browserstack/buildBrowserFromString.j
99
import { run as runTests } from "../run.js";
1010
import readYAML from "../lib/readYAML.js";
1111
import { createTestServer } from "../createTestServer.js";
12+
import { fileURLToPath, pathToFileURL } from "node:url";
1213

1314
const program = new Command();
1415
const DEFAULT_PORT = 3000;
@@ -252,7 +253,7 @@ async function parseMiddleware( config, options ) {
252253
const middleware = await Promise.all(
253254
[ ...( config.middleware ?? [] ), ...( options.middleware ?? [] ) ].map(
254255
async( mw ) => {
255-
const module = await import( resolve( process.cwd(), mw ) );
256+
const module = await import( fileURLToPath( resolve( process.cwd(), mw ) ) );
256257
return module.default;
257258
}
258259
)

queue.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function retryTest( reportId, maxRetries ) {
4545
test.retries++;
4646
if ( test.retries <= maxRetries ) {
4747
console.log(
48-
`\nRetrying test ${ reportId } with URL ${ chalk.yellow( test.url ) }...${
48+
`\nRetrying test ${ reportId } at ${ chalk.yellow( test.url ) }...${
4949
test.retries
5050
}`
5151
);
@@ -63,7 +63,7 @@ export async function hardRetryTest( reportId, maxHardRetries ) {
6363
test.hardRetries++;
6464
if ( test.hardRetries <= maxHardRetries ) {
6565
console.log(
66-
`\nHard retrying test ${ reportId } with URL ${ chalk.yellow(
66+
`\nHard retrying test ${ reportId } at ${ chalk.yellow(
6767
test.url
6868
) }...${ test.hardRetries }`
6969
);

reporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export function reportTest( test, { fullBrowser, id } ) {
116116
export function reportEnd( result, { fullBrowser, id, url } ) {
117117
console.log(
118118
`\n\nTests finished in ${ prettyMs( result.runtime ) } ` +
119-
`with URL ${ chalk.yellow( url ) } ` +
119+
`at ${ chalk.yellow( url ) } ` +
120120
`in ${ chalk.yellow( fullBrowser ) } (${ chalk.bold( id ) })...`
121121
);
122122
console.log(

0 commit comments

Comments
 (0)