forked from angular/components
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstart-devserver.js
More file actions
21 lines (18 loc) · 1016 Bytes
/
Copy pathstart-devserver.js
File metadata and controls
21 lines (18 loc) · 1016 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
const protractor = require('protractor');
// Note: We need to specify an explicit file extension here because otherwise
// the Bazel-patched NodeJS module resolution would resolve to the `.mjs` file
// in non-sandbox environments (as usually with Bazel and Windows).
const utils = require('@bazel/protractor/protractor-utils.js');
/**
* Called by Protractor before starting any tests. This is script is responsible for
* starting up the devserver and updating the Protractor base URL to the proper port.
*/
module.exports = async function (config) {
const {port} = await utils.runServer(config.workspace, config.server, '--port', []);
const baseUrl = `http://localhost:${port}`;
const processedConfig = await protractor.browser.getProcessedConfig();
// Update the protractor "baseUrl" to match the new random TCP port. We need random TCP ports
// because otherwise Bazel could not execute protractor tests concurrently.
protractor.browser.baseUrl = baseUrl;
processedConfig.baseUrl = baseUrl;
};