UNPKG

@vscode/js-debug-browsers

Version:

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

60 lines 2.55 kB
"use strict"; /*--------------------------------------------------------- * Copyright (C) Microsoft Corporation. All rights reserved. *--------------------------------------------------------*/ var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const fs_1 = require("fs"); const path_1 = require("path"); const execa_1 = __importDefault(require("execa")); const darwinEdge_1 = require("./darwinEdge"); const chai_1 = require("chai"); const sinon_1 = require("sinon"); describe('DarwinFinderBase', () => { const validPaths = new Set([ '/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev', '/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta', ]); let accessStub; beforeEach(() => { accessStub = (0, sinon_1.stub)(fs_1.promises, 'access').callsFake((path) => validPaths.has(path.toString()) ? Promise.resolve() : Promise.reject('no acccess')); }); afterEach(() => { accessStub.restore(); }); class ReplacingRegisterFinder extends darwinEdge_1.DarwinEdgeBrowserFinder { constructor(file) { super({}, fs_1.promises, execa_1.default); this.lsRegisterCommand = `cat "${(0, path_1.resolve)(__dirname, '..', 'fixtures', file)}"`; } } it('greps output on Mojave', async () => { const finder = new ReplacingRegisterFinder('edge-mojave-ungrepped.txt'); (0, chai_1.expect)(await finder.findAll()).to.deep.equal([ { path: '/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev', quality: 'dev', }, { path: '/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta', quality: 'beta', }, ]); }); it('greps output on Catalina', async () => { const finder = new ReplacingRegisterFinder('edge-catalina-ungrepped.txt'); (0, chai_1.expect)(await finder.findAll()).to.deep.equal([ { path: '/Applications/Microsoft Edge Dev.app/Contents/MacOS/Microsoft Edge Dev', quality: 'dev', }, { path: '/Applications/Microsoft Edge Beta.app/Contents/MacOS/Microsoft Edge Beta', quality: 'beta', }, ]); }); }); //# sourceMappingURL=darwinFinderBase.test.js.map