From 3aff79c251c10e1c9e1f03fc74c8fa50e8632a5c Mon Sep 17 00:00:00 2001 From: Alan Date: Thu, 9 May 2019 11:25:27 +0300 Subject: [PATCH] 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 --- integration/bazel/test/e2e/on-prepare.ts | 2 +- .../ng-add/files/e2e/protractor.on-prepare.js.template | 2 +- packages/bazel/test/protractor-2/on-prepare.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/integration/bazel/test/e2e/on-prepare.ts b/integration/bazel/test/e2e/on-prepare.ts index 83c96a4ab6..c18d57c81f 100644 --- a/integration/bazel/test/e2e/on-prepare.ts +++ b/integration/bazel/test/e2e/on-prepare.ts @@ -2,7 +2,7 @@ import { browser } from 'protractor'; import {OnPrepareConfig, runServer} from '@angular/bazel/protractor-utils'; 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, []) .then(serverSpec => { const serverUrl = `http://localhost:${serverSpec.port}`; diff --git a/packages/bazel/src/schematics/ng-add/files/e2e/protractor.on-prepare.js.template b/packages/bazel/src/schematics/ng-add/files/e2e/protractor.on-prepare.js.template index 55c33b0ba8..3c4205e227 100644 --- a/packages/bazel/src/schematics/ng-add/files/e2e/protractor.on-prepare.js.template +++ b/packages/bazel/src/schematics/ng-add/files/e2e/protractor.on-prepare.js.template @@ -14,7 +14,7 @@ module.exports = function(config) { // 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 // 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, []) .then(serverSpec => { const serverUrl = `http://localhost:${serverSpec.port}`; diff --git a/packages/bazel/test/protractor-2/on-prepare.js b/packages/bazel/test/protractor-2/on-prepare.js index 1ce5b2d426..a23ce1a212 100644 --- a/packages/bazel/test/protractor-2/on-prepare.js +++ b/packages/bazel/test/protractor-2/on-prepare.js @@ -13,7 +13,7 @@ module.exports = function(config) { if (!global.userOnPrepareGotCalled) { 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, []) .then(serverSpec => { const serverUrl = `http://localhost:${serverSpec.port}`;