Skip to content

Commit 3202e88

Browse files
committed
fix(server): fix baseUrl option for serve command
1 parent 8d7be85 commit 3202e88

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

bin/command.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,10 +190,11 @@ yargs( process.argv.slice( 2 ) )
190190
"Pass multiple by repeating the option."
191191
} );
192192
},
193-
handler: async( { baseUrl, configFile, quiet, ...argv } ) => {
193+
handler: async( { configFile, quiet, ...argv } ) => {
194194
console.log( "Starting server..." );
195195
const config = await readYAML( configFile );
196196
const middleware = await parseMiddleware( config, argv );
197+
const baseUrl = config.baseUrl ?? argv.baseUrl ?? "/test/";
197198

198199
/**
199200
* Run a simple server for loading tests in a browser.

run.js

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,6 @@ export async function run( {
3535
runId,
3636
verbose
3737
} ) {
38-
if ( !baseUrl ) {
39-
throw new Error( "No baseUrl specified." );
40-
}
41-
42-
// Ensure baseUrl ends with a slash
43-
if ( !rendsWithSlash.test( baseUrl ) ) {
44-
baseUrl += "/";
45-
}
4638
if ( !browserNames.length ) {
4739
browserNames = [ "chrome" ];
4840
}
@@ -52,6 +44,11 @@ export async function run( {
5244
);
5345
}
5446

47+
// Ensure baseUrl ends with a slash
48+
if ( !rendsWithSlash.test( baseUrl ) ) {
49+
baseUrl += "/";
50+
}
51+
5552
if ( verbose ) {
5653
console.log( browserstack ? "Running in BrowserStack." : "Running locally." );
5754
}

0 commit comments

Comments
 (0)