Alan 3aff79c251 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
2019-05-09 11:20:51 -07:00

23 lines
793 B
JavaScript

/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
const protractorUtils = require('@angular/bazel/protractor-utils');
const protractor = require('protractor');
module.exports = function(config) {
if (!global.userOnPrepareGotCalled) {
throw new Error('Expecting user configuration onPrepare to have been called');
}
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}`;
protractor.browser.baseUrl = serverUrl;
});
};