From 12327564259e22b17c595c06aae8e69e5a4de84c Mon Sep 17 00:00:00 2001 From: Zach Bloomquist Date: Wed, 13 Mar 2019 11:33:57 -0400 Subject: [PATCH] minor: just returns on linux --- package.json | 5 +---- src/get-windows-proxy-spec.js | 5 +++++ src/index.js | 15 +++------------ 3 files changed, 9 insertions(+), 16 deletions(-) diff --git a/package.json b/package.json index 8ef9860..900137b 100644 --- a/package.json +++ b/package.json @@ -4,9 +4,6 @@ "version": "0.0.0-development", "author": "Zach Bloomquist ", "bugs": "https://github.com/cypress-io/get-windows-proxy/issues", - "os": [ - "win32" - ], "config": { "pre-git": { "commit-msg": "simple", @@ -83,7 +80,7 @@ "sinon": "7.2.5" }, "dependencies": { - "@cypress/registry-js": "1.3.2-patch27", + "@cypress/registry-js": "1.3.2-patch29", "debug": "4.1.1" } } diff --git a/src/get-windows-proxy-spec.js b/src/get-windows-proxy-spec.js index 7088af9..ea5993b 100644 --- a/src/get-windows-proxy-spec.js +++ b/src/get-windows-proxy-spec.js @@ -1,4 +1,5 @@ const { expect } = require('chai') +const os = require('os') const registry = require('@cypress/registry-js') const sinon = require('sinon') @@ -6,6 +7,10 @@ const sinon = require('sinon') const getWindowsProxy = require('.') context('getWindowsProxy', () => { + beforeEach(() => { + sinon.stub(os, 'platform').returns('win32') + }) + afterEach(() => { sinon.restore() }) diff --git a/src/index.js b/src/index.js index 985565c..ecd924c 100644 --- a/src/index.js +++ b/src/index.js @@ -1,15 +1,6 @@ const debug = require('debug')('get-windows-proxy') -let registry - -try { - registry = require('@cypress/registry-js') -} catch (err) { - if (err.code !== 'MODULE_NOT_FOUND') { - throw err - } - - debug('Could not load native extension for Windows registry access. The most likely reason is that your Node version has changed since installing. Try re-installing get-windows-proxy.') -} +const os = require('os') +const registry = require('@cypress/registry-js') const findByName = (values, name) => { return values.find((value) => { @@ -18,7 +9,7 @@ const findByName = (values, name) => { } module.exports = function getWindowsProxy () { - if (!registry) { + if (!registry || os.platform() !== 'win32') { return }