UNPKG

@vscode/js-debug-browsers

Version:

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

53 lines 2.04 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const windowsFirefox_1 = require("./windowsFirefox"); describe('windows: firefox', () => { const test = (pathsThatExist) => { const fs = { access: (path) => { if (!pathsThatExist.includes(path)) { throw new Error('no access here!'); } }, }; return new windowsFirefox_1.WindowsFirefoxBrowserFinder({ LOCALAPPDATA: '%APPDATA%', PROGRAMFILES: '%PROGRAMFILES%', 'PROGRAMFILES(X86)': '%PROGRAMFILES(X86)%', FIREFOX_PATH: 'C:\\custom\\path\\firefox.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\\firefox.exe', '%PROGRAMFILES%\\Firefox Developer Edition\\firefox.exe', '%PROGRAMFILES%\\Firefox Nightly\\firefox.exe', '%APPDATA%\\Mozilla Firefox\\firefox.exe', ])).to.deep.equal([ { path: 'C:\\custom\\path\\firefox.exe', quality: "custom" /* Custom */, }, { path: '%APPDATA%\\Mozilla Firefox\\firefox.exe', quality: "stable" /* Stable */, }, { path: '%PROGRAMFILES%\\Firefox Developer Edition\\firefox.exe', quality: "dev" /* Dev */, }, { path: '%PROGRAMFILES%\\Firefox Nightly\\firefox.exe', quality: "canary" /* Canary */, }, ]); }); }); //# sourceMappingURL=windowsFirefox.test.js.map