From 9101780c2294ac8c4f44cc98b26cea41d1776ea2 Mon Sep 17 00:00:00 2001 From: Aleen Date: Tue, 9 Mar 2021 16:02:25 +0800 Subject: [PATCH] Detect Chromium Edge with the plugin @chiragrupani/karma-chromium-edge-launcher --- README.md | 4 ++-- browsers/Edge.js | 17 +++++++++++------ package.json | 2 +- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index 44c437a..b266a11 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ module.exports = function(config) { plugins: [ 'karma-chrome-launcher', - 'karma-edge-launcher', + '@chiragrupani/karma-chromium-edge-launcher', 'karma-firefox-launcher', 'karma-ie-launcher', 'karma-safari-launcher', @@ -103,7 +103,7 @@ module.exports = function(config) { plugins: [ 'karma-chrome-launcher', - 'karma-edge-launcher', + '@chiragrupani/karma-chromium-edge-launcher', 'karma-firefox-launcher', 'karma-ie-launcher', 'karma-safari-launcher', diff --git a/browsers/Edge.js b/browsers/Edge.js index fe3a57b..1083c1d 100644 --- a/browsers/Edge.js +++ b/browsers/Edge.js @@ -1,15 +1,20 @@ -var CMD; +var linux, darwin, win32; try { - CMD = require.resolve('edge-launcher/dist/x86/MicrosoftEdgeLauncher.exe'); -} catch (e) { - CMD = ''; -} + var CMD = require('@chiragrupani/karma-chromium-edge-launcher')['launcher:Edge'][1].prototype.DEFAULT_CMD; + linux = CMD.linux, darwin = CMD.darwin, win32 = CMD.win32; +} catch (ignore) {} + +try { + win32 = require.resolve('edge-launcher/dist/x86/MicrosoftEdgeLauncher.exe'); +} catch (ignore) {} module.exports = { name: 'Edge', DEFAULT_CMD: { - win32: [CMD] + linux: [linux || ''], + darwin: [darwin || ''], + win32: [win32 || ''] }, ENV_CMD: 'EDGE_BIN' }; diff --git a/package.json b/package.json index 56d9336..75b8dc8 100644 --- a/package.json +++ b/package.json @@ -81,7 +81,7 @@ "jasmine-core": "^3.1.0", "karma": "^2.0.0", "karma-chrome-launcher": "*", - "karma-edge-launcher": "*", + "@chiragrupani/karma-chromium-edge-launcher": "*", "karma-firefox-launcher": "*", "karma-ie-launcher": "*", "karma-jasmine": "^1.1.0",