Skip to content

Commit 48836a8

Browse files
author
Marco Marche
authored
build: prevent binding BrowserSync UI server during test execution (#23733)
1 parent 75371f7 commit 48836a8

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

tools/dev-server/dev-server.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,12 @@ export class DevServer {
3838
};
3939

4040
constructor(
41-
readonly port: number, private _rootPaths: string[],
42-
private _historyApiFallback: boolean = false) {}
41+
readonly port: number, private _rootPaths: string[], bindUi: boolean,
42+
private _historyApiFallback: boolean = false) {
43+
if (bindUi === false) {
44+
this.options.ui = false;
45+
}
46+
}
4347

4448
/** Starts the server on the given port. */
4549
start() {

tools/dev-server/main.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ const {root_paths: _rootPathsRaw, port, historyApiFallback} =
1616
minimist(args, {boolean: 'historyApiFallback'});
1717
const rootPaths = _rootPathsRaw ? _rootPathsRaw.split(',') : ['/'];
1818

19-
const server = new DevServer(port, rootPaths, historyApiFallback);
19+
const bindUi = process.env.TEST_TARGET === undefined;
20+
const server = new DevServer(port, rootPaths, bindUi, historyApiFallback);
2021

2122
// Setup ibazel support.
2223
setupBazelWatcherSupport(server);
2324

2425
// Start the devserver. The server will always bind to the loopback and
2526
// the public interface of the current host.
2627
server.start();
27-

0 commit comments

Comments
 (0)