UNPKG

@vscode/js-debug-browsers

Version:

Browser launch and discovery logic used in VS Code's JavaScript Debugger

53 lines 2.09 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const windowsChrome_1 = require("./windowsChrome"); describe('windows: chrome', () => { const test = (pathsThatExist) => { const fs = { access: (path) => { if (!pathsThatExist.includes(path)) { throw new Error('no access here!'); } }, }; return new windowsChrome_1.WindowsChromeBrowserFinder({ LOCALAPPDATA: '%APPDATA%', PROGRAMFILES: '%PROGRAMFILES%', 'PROGRAMFILES(X86)': '%PROGRAMFILES(X86)%', CHROME_PATH: 'C:\\custom\\path\\chrome.exe', }, fs).findAll(); }; it('does not return when paths dont exist', async () => { (0, chai_1.expect)(await test([])).to.be.empty; }); it('returns and orders correctly', async () => { (0, chai_1.expect)(await test([ 'C:\\custom\\path\\chrome.exe', '%PROGRAMFILES%\\Google\\Chrome SxS\\Application\\chrome.exe', '%APPDATA%\\Google\\Chrome\\Application\\chrome.exe', '%APPDATA%\\Google\\Chrome SxS\\Application\\chrome.exe', ])).to.deep.equal([ { path: 'C:\\custom\\path\\chrome.exe', quality: "custom" /* Custom */, }, { path: '%APPDATA%\\Google\\Chrome SxS\\Application\\chrome.exe', quality: "canary" /* Canary */, }, { path: '%APPDATA%\\Google\\Chrome\\Application\\chrome.exe', quality: "stable" /* Stable */, }, { path: '%PROGRAMFILES%\\Google\\Chrome SxS\\Application\\chrome.exe', quality: "canary" /* Canary */, }, ]); }); }); //# sourceMappingURL=windowsChrome.test.js.map