Skip to content
This repository was archived by the owner on Sep 21, 2021. It is now read-only.

Commit d479565

Browse files
joshungerjasonLaster
authored andcommitted
run prettier on devtools-launchpad/bin/*.js (#1061)
1 parent eb45a5f commit d479565

File tree

3 files changed

+33
-24
lines changed

3 files changed

+33
-24
lines changed

packages/devtools-launchpad/bin/chrome-driver.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44
* License, v. 2.0. If a copy of the MPL was not distributed with this
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
66

7-
const spawn = require('child_process').spawn;
7+
const spawn = require("child_process").spawn;
88
const minimist = require("minimist");
99

1010
const os = require("os");
1111

1212
const isWindows = /^win/.test(process.platform);
1313

14-
const chromeBinary = isWindows ?
15-
"c:\\program files (x86)\\google\\chrome\\application\\chrome.exe" :
16-
"/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome";
14+
const chromeBinary = isWindows
15+
? "c:\\program files (x86)\\google\\chrome\\application\\chrome.exe"
16+
: "/Applications/Google Chrome.app/Contents/MacOS/Google Chrome";
1717

1818
const args = minimist(process.argv.slice(2), {
1919
string: ["location"]
@@ -29,10 +29,10 @@ chromeArgs.push(args.location ? args.location : "about:blank");
2929

3030
const chrome = spawn(chromeBinary, chromeArgs);
3131

32-
chrome.stdout.on('data', data => console.log(`stdout: ${data}`));
33-
chrome.stderr.on('data', data => console.log(`stderr: ${data}`));
34-
chrome.on('close', code => console.log(`chrome exited with code ${code}`));
35-
chrome.on('error', error => {
32+
chrome.stdout.on("data", data => console.log(`stdout: ${data}`));
33+
chrome.stderr.on("data", data => console.log(`stderr: ${data}`));
34+
chrome.on("close", code => console.log(`chrome exited with code ${code}`));
35+
chrome.on("error", error => {
3636
if (error.code == "ENOENT") {
3737
console.log(`Hmm, could not find the path ${chromeBinary}.`);
3838
console.log("Try looking for chrome with ls /Applications");

packages/devtools-launchpad/bin/firefox-driver.js

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,22 +5,21 @@
55
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
66

77
const minimist = require("minimist");
8-
const url = require('url');
9-
var path = require('path');
8+
const url = require("url");
9+
var path = require("path");
1010
const webdriver = require("selenium-webdriver");
1111
const firefox = require("selenium-webdriver/firefox");
1212
const isWindows = /^win/.test(process.platform);
1313

14-
addGeckoDriverToPath()
14+
addGeckoDriverToPath();
1515

1616
const By = webdriver.By;
1717
const until = webdriver.until;
1818
const Key = webdriver.Key;
1919

20-
const args = minimist(process.argv.slice(2),
21-
{
20+
const args = minimist(process.argv.slice(2), {
2221
boolean: ["start", "tests", "websocket"],
23-
string: ["location"],
22+
string: ["location"]
2423
});
2524

2625
const shouldStart = args.start;
@@ -32,16 +31,19 @@ function addGeckoDriverToPath() {
3231
// NOTE: when the launchpad is symlinked we ned to check for
3332
// geckodriver in a different location
3433
const isSymLinked = __dirname.match(/devtools-core/);
35-
const relativeGeckoPath = isSymLinked ?
36-
'../node_modules/geckodriver' : '../../geckodriver';
34+
const relativeGeckoPath = isSymLinked
35+
? "../node_modules/geckodriver"
36+
: "../../geckodriver";
3737
const geckoDriverPath = path.resolve(__dirname, relativeGeckoPath);
3838
process.env.PATH = `${geckoDriverPath}${path.delimiter}${process.env.PATH}`;
3939
}
4040

4141
function binaryArgs() {
42-
const connectionString = useWebSocket ? `ws:${connectionPort}` : `${connectionPort}`;
42+
const connectionString = useWebSocket
43+
? `ws:${connectionPort}`
44+
: `${connectionPort}`;
4345
if (isWindows) {
44-
return ["-start-debugger-server", connectionString]; // e.g. -start-debugger-server 6080
46+
return ["-start-debugger-server", connectionString]; // e.g. -start-debugger-server 6080
4547
} else {
4648
return ["--start-debugger-server=" + connectionString]; // e.g. --start-debugger-server=6080
4749
}
@@ -71,7 +73,9 @@ function firefoxProfile() {
7173
function start(_url, _options = {}) {
7274
if (_options.useWebSocket) {
7375
useWebSocket = true;
74-
connectionPort = _options.webSocketPort ? _options.webSocketPort : connectionPort;
76+
connectionPort = _options.webSocketPort
77+
? _options.webSocketPort
78+
: connectionPort;
7579
} else {
7680
connectionPort = _options.tcpPort ? _options.tcpPort : connectionPort;
7781
}
@@ -88,22 +92,23 @@ function start(_url, _options = {}) {
8892

8993
let location = url.parse(_url);
9094
if (location.protocol === null) {
91-
location.protocol = 'http:';
95+
location.protocol = "http:";
9296
}
9397
driver.get(url.format(location));
9498

9599
return driver;
96100
}
97101

98102
if (shouldStart) {
99-
start(args.location || 'about:blank');
103+
start(args.location || "about:blank");
100104
setInterval(() => {}, 100);
101105
}
102106

103107
function getResults(driver) {
104108
driver
105109
.findElement(By.id("mocha-stats"))
106-
.getText().then(results => {
110+
.getText()
111+
.then(results => {
107112
console.log("results ", results);
108113
const match = results.match(/failures: (\d*)/);
109114
const resultCode = parseInt(match[1], 10) > 0 ? 1 : 0;

packages/devtools-launchpad/bin/validate-deps.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* License, v. 2.0. If a copy of the MPL was not distributed with this
33
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

5-
const fs = require('fs');
5+
const fs = require("fs");
66
const path = require("path");
77

88
function isUnique(list) {
@@ -21,6 +21,10 @@ const depsList = devtoolDeps.map(dep => dep.replace(/@.*/, ""));
2121
const hasDuplicates = !isUnique(depsList);
2222

2323
if (hasDuplicates) {
24-
console.warn(`Oops, it looks like there's duplicate dependencies:\n\n${devtoolDeps.join("\n")}\n\nCheck your yarn.lock file for the discrepancy.`);
24+
console.warn(
25+
`Oops, it looks like there's duplicate dependencies:\n\n${devtoolDeps.join(
26+
"\n"
27+
)}\n\nCheck your yarn.lock file for the discrepancy.`
28+
);
2529
process.exit(1);
2630
}

0 commit comments

Comments
 (0)