env-create
Advanced tools
Comparing version 1.1.1 to 1.1.3
const fs = require('fs') | ||
const chai = require('chai') | ||
chai.should() | ||
const sandbox = require('sinon').createSandbox() | ||
const sinon = require('sinon') | ||
const sandbox = sinon.createSandbox() | ||
const envCreate = require('./main') | ||
@@ -21,3 +22,2 @@ | ||
}) | ||
it('should...', () => { | ||
@@ -28,4 +28,6 @@ {(() => envCreate.load).should.throw} | ||
describe('when it does not throw should', () => { | ||
// have to use match since the default filename is prepended with the path | ||
const hasDefaultFilename = () => readFileSyncStub.calledWith(sinon.match(envCreate.DEFAULT_ENV_FILENAME)) | ||
describe('when it does not throw should', () => { | ||
beforeEach(() => { | ||
@@ -49,3 +51,3 @@ readFileSyncStub = sandbox.stub(fs, 'readFileSync').returns(mockReadResponse) | ||
envCreate.load() | ||
readFileSyncStub.args[0][0].should.contain(envCreate.DEFAULT_ENV_FILENAME) | ||
hasDefaultFilename().should.be.true | ||
}) | ||
@@ -55,3 +57,3 @@ | ||
envCreate.load({path: ''}) | ||
readFileSyncStub.args[0][0].should.contain(envCreate.DEFAULT_ENV_FILENAME) | ||
hasDefaultFilename().should.be.true | ||
}) | ||
@@ -68,3 +70,4 @@ | ||
envCreate.load(fakeEncoding) | ||
readFileSyncStub.calledWith(fakeEncoding.encoding) | ||
// don't care about the first parameter (already tested above) | ||
readFileSyncStub.calledWith(sinon.match.any, fakeEncoding.encoding).should.be.true | ||
}) | ||
@@ -85,16 +88,15 @@ it('messages returned when debug property supplied ', () => { | ||
let preExists | ||
const debugTest = (value) => { | ||
envCreate.load({debug: value}) | ||
process.env.secret1.should.equal(preExists) | ||
} | ||
let value = false | ||
beforeEach(() => { | ||
preExists = 'I am therefore I am' | ||
process.env.secret1 = preExists | ||
value = !value | ||
envCreate.load({debug: value}) | ||
}) | ||
it('when debug is true', () => { | ||
debugTest(true) | ||
process.env.secret1.should.equal(preExists) | ||
}) | ||
it('when debug is false', () => { | ||
debugTest(false) | ||
process.env.secret1.should.equal(preExists) | ||
}) | ||
@@ -101,0 +103,0 @@ }) |
{ | ||
"name": "env-create", | ||
"version": "1.1.1", | ||
"version": "1.1.3", | ||
"description": "Read in a .env.json file that contains valid JSON and assign top level properties to environment variables", | ||
@@ -14,3 +14,3 @@ "repository": { | ||
"lint": "eslint lib --color", | ||
"build": "npm run lint && npm test && git add -A && npm version patch && npm publish " | ||
"build": "npm test && git add -A && npm version patch && npm publish " | ||
}, | ||
@@ -36,12 +36,11 @@ "author": "Tod Gentille", | ||
"devDependencies": { | ||
"chai": "^4.2.0", | ||
"eslint": "^5.15.1", | ||
"mocha": "^6.0.2", | ||
"nyc": "^13.3.0", | ||
"sinon": "^7.2.7" | ||
"chai": "^4.3.4", | ||
"eslint": "^7.27.0", | ||
"mocha": "^9.2.1", | ||
"nyc": "^15.1.0", | ||
"sinon": "^11.1.1" | ||
}, | ||
"engines": { | ||
"node": ">=6" | ||
}, | ||
"dependencies": {} | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Native code
Supply chain riskContains native code (e.g., compiled binaries or shared libraries). Including native code can obscure malicious behavior.
Found 1 instance in 1 package
13
0
16594
162
11