From fd3ff7207554411f84ff5bc5e1ac357627b172f1 Mon Sep 17 00:00:00 2001 From: Joey Parrish Date: Thu, 7 Sep 2023 19:02:19 -0700 Subject: [PATCH] fix: Fix exception thrown when Edge executable is not found (#62) --- index.js | 2 +- package-lock.json | 50 +++++++++++++++++++++++++++++++++++------------ package.json | 4 ++-- 3 files changed, 40 insertions(+), 16 deletions(-) diff --git a/index.js b/index.js index c380f2d..ec2e29f 100644 --- a/index.js +++ b/index.js @@ -300,7 +300,7 @@ const LocalWebDriverChromeHeadless = generateSubclass( // that explicitly. This works around the following edgedriver bug: // https://github.com/MicrosoftEdge/EdgeWebDriver/issues/102#issuecomment-1710724173 const edgeOptions = {}; -const edgeBinary = which.sync('microsoft-edge'); +const edgeBinary = which.sync('microsoft-edge', {nothrow: true}); if (edgeBinary) { edgeOptions['ms:edgeOptions'] = { binary: edgeBinary, diff --git a/package-lock.json b/package-lock.json index 6aacff8..8ae6601 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,9 +10,9 @@ "license": "Apache-2.0", "dependencies": { "lodash": "^4.17.21", - "node-which": "^1.0.0", "wd": "^1.14.0", - "webdriver-installer": "^1.1.9" + "webdriver-installer": "^1.1.9", + "which": "^4.0.0" }, "peerDependencies": { "karma": "^6.2.0" @@ -1133,6 +1133,14 @@ "url": "https://github.com/sponsors/gjtorikian/" } }, + "node_modules/isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==", + "engines": { + "node": ">=16" + } + }, "node_modules/isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -1487,12 +1495,6 @@ } } }, - "node_modules/node-which": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-which/-/node-which-1.0.0.tgz", - "integrity": "sha512-PVVbv6DyDc3VkTizcd/7Xchn3NDh+OUnQkrHxgumQ+2lwoWE36KuQClfAVjTwEh3T0jzb1WHrbgCol5HbBZqdQ==", - "deprecated": "please use 'which'" - }, "node_modules/normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -2331,6 +2333,20 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "dependencies": { + "isexe": "^3.1.1" + }, + "bin": { + "node-which": "bin/which.js" + }, + "engines": { + "node": "^16.13.0 || >=18.0.0" + } + }, "node_modules/wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", @@ -3320,6 +3336,11 @@ "integrity": "sha512-53h6XFniq77YdW+spoRrebh0mnmTxRPTlcuIArO57lmMdq4uBKFKaeTjnb92oYWrSn/LVL+LT+Hap2tFQj8V+w==", "peer": true }, + "isexe": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-3.1.1.tgz", + "integrity": "sha512-LpB/54B+/2J5hqQ7imZHfdU31OlgQqx7ZicVlkm9kzg9/w8GKLEcFfJl/t7DCEDueOyBAD6zCCwTO6Fzs0NoEQ==" + }, "isstream": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", @@ -3607,11 +3628,6 @@ "whatwg-url": "^5.0.0" } }, - "node-which": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/node-which/-/node-which-1.0.0.tgz", - "integrity": "sha512-PVVbv6DyDc3VkTizcd/7Xchn3NDh+OUnQkrHxgumQ+2lwoWE36KuQClfAVjTwEh3T0jzb1WHrbgCol5HbBZqdQ==" - }, "normalize-path": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", @@ -4247,6 +4263,14 @@ "webidl-conversions": "^3.0.0" } }, + "which": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/which/-/which-4.0.0.tgz", + "integrity": "sha512-GlaYyEb07DPxYCKhKzplCWBJtvxZcZMrL+4UkrTSJHHPyZU4mYYTv3qaOe77H7EODLSSopAUFAc6W8U4yqvscg==", + "requires": { + "isexe": "^3.1.1" + } + }, "wrap-ansi": { "version": "7.0.0", "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", diff --git a/package.json b/package.json index 6c3a58f..cf5f033 100644 --- a/package.json +++ b/package.json @@ -18,9 +18,9 @@ "author": "Joey Parrish ", "dependencies": { "lodash": "^4.17.21", - "node-which": "^1.0.0", "wd": "^1.14.0", - "webdriver-installer": "^1.1.9" + "webdriver-installer": "^1.1.9", + "which": "^4.0.0" }, "peerDependencies": { "karma": "^6.2.0"