UNPKG

@vscode/js-debug-browsers

Version:

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

58 lines 2.31 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ Object.defineProperty(exports, "__esModule", { value: true }); const chai_1 = require("chai"); const windowsEdge_1 = require("./windowsEdge"); describe('windows: edge', () => { const test = (pathsThatExist) => { const fs = { access: (path) => { if (!pathsThatExist.includes(path)) { throw new Error('no access here!'); } }, }; return new windowsEdge_1.WindowsEdgeBrowserFinder({ LOCALAPPDATA: '%APPDATA%', PROGRAMFILES: '%PROGRAMFILES%', 'PROGRAMFILES(X86)': '%PROGRAMFILES(X86)%', EDGE_PATH: 'C:\\custom\\path\\edge.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\\edge.exe', '%PROGRAMFILES%\\Microsoft\\Edge SxS\\Application\\msedge.exe', '%PROGRAMFILES%\\Microsoft\\Edge Dev\\Application\\msedge.exe', '%APPDATA%\\Microsoft\\Edge\\Application\\msedge.exe', '%APPDATA%\\Microsoft\\Edge SxS\\Application\\msedge.exe', ])).to.deep.equal([ { path: 'C:\\custom\\path\\edge.exe', quality: "custom" /* Custom */, }, { path: '%APPDATA%\\Microsoft\\Edge SxS\\Application\\msedge.exe', quality: "canary" /* Canary */, }, { path: '%APPDATA%\\Microsoft\\Edge\\Application\\msedge.exe', quality: "stable" /* Stable */, }, { path: '%PROGRAMFILES%\\Microsoft\\Edge SxS\\Application\\msedge.exe', quality: "canary" /* Canary */, }, { path: '%PROGRAMFILES%\\Microsoft\\Edge Dev\\Application\\msedge.exe', quality: "dev" /* Dev */, }, ]); }); }); //# sourceMappingURL=windowsEdge.test.js.map