fix(bazel): pass correct arguments to http_server in Windows (#30346)

Under Windows, the server binary has an extension of  `.exe` and the current logic is not handling that.

Partially addresses: #29785

PR Close #30346
This commit is contained in:
Alan 2019-05-09 11:25:27 +03:00 committed by Alex Rickabaugh
parent d8665e639b
commit 3aff79c251
3 changed files with 3 additions and 3 deletions

View File

@ -2,7 +2,7 @@ import { browser } from 'protractor';
import {OnPrepareConfig, runServer} from '@angular/bazel/protractor-utils'; import {OnPrepareConfig, runServer} from '@angular/bazel/protractor-utils';
export = function(config: OnPrepareConfig) { export = function(config: OnPrepareConfig) {
const portFlag = config.server.endsWith('prodserver') ? '-p' : '-port'; const portFlag = /prodserver(\.exe)?$/.test(config.server) ? '-p' : '-port';
return runServer(config.workspace, config.server, portFlag, []) return runServer(config.workspace, config.server, portFlag, [])
.then(serverSpec => { .then(serverSpec => {
const serverUrl = `http://localhost:${serverSpec.port}`; const serverUrl = `http://localhost:${serverSpec.port}`;

View File

@ -14,7 +14,7 @@ module.exports = function(config) {
// selected port (given a port flag to pass to the server as an argument). // selected port (given a port flag to pass to the server as an argument).
// The port used is returned in serverSpec and the protractor serverUrl // The port used is returned in serverSpec and the protractor serverUrl
// is the configured. // is the configured.
const portFlag = config.server.endsWith('prodserver') ? '-p' : '-port'; const portFlag = /prodserver(\.exe)?$/.test(config.server) ? '-p' : '-port';
return protractorUtils.runServer(config.workspace, config.server, portFlag, []) return protractorUtils.runServer(config.workspace, config.server, portFlag, [])
.then(serverSpec => { .then(serverSpec => {
const serverUrl = `http://localhost:${serverSpec.port}`; const serverUrl = `http://localhost:${serverSpec.port}`;

View File

@ -13,7 +13,7 @@ module.exports = function(config) {
if (!global.userOnPrepareGotCalled) { if (!global.userOnPrepareGotCalled) {
throw new Error('Expecting user configuration onPrepare to have been called'); throw new Error('Expecting user configuration onPrepare to have been called');
} }
const portFlag = config.server.endsWith('prodserver') ? '-p' : '-port'; const portFlag = /prodserver(\.exe)?$/.test(config.server) ? '-p' : '-port';
return protractorUtils.runServer(config.workspace, config.server, portFlag, []) return protractorUtils.runServer(config.workspace, config.server, portFlag, [])
.then(serverSpec => { .then(serverSpec => {
const serverUrl = `http://localhost:${serverSpec.port}`; const serverUrl = `http://localhost:${serverSpec.port}`;