UNPKG

1.92 kBJavaScriptView Raw
1"use strict";
2/**
3 * @license
4 * Copyright (c) 2019 The Polymer Project Authors. All rights reserved.
5 * This code may only be used under the BSD style license found at
6 * http://polymer.github.io/LICENSE.txt The complete set of authors may be found
7 * at http://polymer.github.io/AUTHORS.txt The complete set of contributors may
8 * be found at http://polymer.github.io/CONTRIBUTORS.txt Code distributed by
9 * Google as part of the polymer project is also subject to an additional IP
10 * rights grant found at http://polymer.github.io/PATENTS.txt
11 */
12Object.defineProperty(exports, "__esModule", { value: true });
13exports.manualMode = void 0;
14const ansi = require("ansi-escape-sequences");
15const specs_1 = require("./specs");
16/**
17 * Let the user run benchmarks manually. This process will not exit until
18 * the user sends a termination signal.
19 */
20async function manualMode(config, servers) {
21 if (config.csvFileStats || config.csvFileRaw || config.jsonFile ||
22 config.legacyJsonFile) {
23 throw new Error(`Can't save results in manual mode`);
24 }
25 console.log('\nVisit these URLs in any browser:');
26 const allServers = new Set([...servers.values()]);
27 for (const spec of config.benchmarks) {
28 console.log();
29 if (spec.url.kind === 'local') {
30 console.log(`${spec.name}${spec.url.queryString}` +
31 (spec.url.version !== undefined ? ` [@${spec.url.version.label}]` :
32 ''));
33 }
34 console.log(ansi.format(`[yellow]{${specs_1.specUrl(spec, servers, config)}}`));
35 }
36 for (const server of [...allServers]) {
37 (async function () {
38 while (true) {
39 const result = await server.nextResults();
40 server.endSession();
41 console.log(`${result.millis.toFixed(3)} ms`);
42 }
43 })();
44 }
45}
46exports.manualMode = manualMode;
47//# sourceMappingURL=manual.js.map
\No newline at end of file