MCPcopy Create free account
hub / github.com/ChromeDevTools/chrome-devtools-mcp / resolveDefaultChromePath

Function resolveDefaultChromePath

scripts/test.js:22–68  ·  view source on GitHub ↗
(buildDir)

Source from the content-addressed store, hash-verified

20const devtoolsRoot = path.resolve(projectRoot, '..');
21
22function resolveDefaultChromePath(buildDir) {
23 if (!fs.existsSync(path.join(devtoolsRoot, 'front_end'))) {
24 return undefined;
25 }
26 const platform = os.platform();
27 let cftRel;
28 if (platform === 'linux') {
29 cftRel = path.join('chrome-linux', 'chrome-linux64', 'chrome');
30 } else if (platform === 'darwin') {
31 const name = os.arch() === 'arm64' ? 'chrome-mac-arm64' : 'chrome-mac-x64';
32 cftRel = path.join(
33 name,
34 name,
35 'Google Chrome for Testing.app',
36 'Contents',
37 'MacOS',
38 'Google Chrome for Testing',
39 );
40 } else if (platform === 'win32') {
41 cftRel = path.join('chrome-win', 'chrome-win64', 'chrome.exe');
42 }
43
44 if (cftRel) {
45 const cftCandidate = path.join(
46 devtoolsRoot,
47 'third_party',
48 'chrome',
49 cftRel,
50 );
51 if (fs.existsSync(cftCandidate)) {
52 return cftCandidate;
53 }
54 }
55
56 const builtNames = {
57 linux: 'chrome',
58 darwin: path.join('Chromium.app', 'Contents', 'MacOS', 'Chromium'),
59 win32: 'chrome.exe',
60 };
61 if (platform in builtNames) {
62 const builtCandidate = path.join(buildDir, builtNames[platform]);
63 if (fs.existsSync(builtCandidate)) {
64 return builtCandidate;
65 }
66 }
67 return undefined;
68}
69
70const ownOptions = {
71 retry: {

Callers 1

test.jsFile · 0.85

Calls 1

platformMethod · 0.45

Tested by

no test coverage detected