Skip to content

Commit

Permalink
fix: remove tests, point directly to npm config settings for ca and S…
Browse files Browse the repository at this point in the history
…trictSSL
  • Loading branch information
mefellows committed Mar 10, 2020
1 parent d264f0b commit ae36609
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 28 deletions.
23 changes: 1 addition & 22 deletions standalone/install.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import * as fs from 'fs';
import * as path from 'path';
import * as chai from 'chai';
import { BinaryEntry, Config, useStrictSSL } from './install';
import { BinaryEntry, Config } from './install';

const expect = chai.expect;

Expand All @@ -19,27 +19,6 @@ describe('Install', () => {
}
});

describe('#useStrictSSL', () => {
afterEach(() => {
delete process.env['npm_config_strict-ssl']
})
describe('when "strict-ssl" is specified in an NPM configuration', () => {
it('returns a true', () => {
process.env['npm_config_strict-ssl'] = "true"
expect(useStrictSSL()).to.be.true
})
it('returns a false', () => {
process.env['npm_config_strict-ssl'] = "false"
expect(useStrictSSL()).to.be.false
})
})
describe('when "strict-ssl" is not specified in any NPM configuration', () => {
it('returns true', () => {
expect(useStrictSSL()).to.be.true
})
})
})

function createConfig(): Config {
return require('./install').createConfig();
}
Expand Down
8 changes: 2 additions & 6 deletions standalone/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,11 +144,6 @@ const CIs = [
'WERCKER_ROOT',
];

export function useStrictSSL(): boolean {
const prop = config.read()['strict-ssl']
return prop === "true" || prop === undefined || prop === ""
}

function downloadFileRetry(
url: string,
filepath: string,
Expand All @@ -164,7 +159,8 @@ function downloadFileRetry(
headers: {
'User-Agent': 'https://github.com/pact-foundation/pact-node',
},
strictSSL: useStrictSSL()
strictSSL: config.read()['strict-ssl'],
ca: config.read()['cafile'],
})
.on('error', (e: string) => reject(e))
.on(
Expand Down

0 comments on commit ae36609

Please sign in to comment.