Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

env-create

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

env-create - npm Package Compare versions

Comparing version 1.1.1 to 1.1.3

.nyc_output/2af00f03-0236-44c1-b697-03bbdacc38a4.json

26

lib/main.test.js
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": {}
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc