Comparing version 1.3.3 to 1.3.4
1.3.4 / 2015-09-24 | ||
================== | ||
* test: use codecov.io | ||
* feat: support mock process.env.KEY | ||
1.3.3 / 2015-09-17 | ||
@@ -3,0 +9,0 @@ ================== |
@@ -25,3 +25,15 @@ /**! | ||
var mock = module.exports = function mock(/*obj, key, method*/) { | ||
var nodeMajorVersion = Number(process.versions.node.split('.')[0]); | ||
var mockEnvs = [ | ||
// [key, originValue], ... | ||
]; | ||
var mock = module.exports = function mock(obj, key, method) { | ||
if (nodeMajorVersion < 4 && obj === process.env) { | ||
// hotfix for https://github.com/nodejs/node/pull/2999 on node<4.0.0 | ||
// use empty string instead of undefined or null | ||
method = method || ''; | ||
mockEnvs.push([ key, process.env[key] ]); | ||
} | ||
return muk.apply(null, arguments); | ||
@@ -445,3 +457,13 @@ }; | ||
muk.restore(); | ||
if (mockEnvs.length > 0) { | ||
var item = mockEnvs[0]; | ||
if (item[1] === undefined || item[1] === null) { | ||
process.env[item[0]] = ''; | ||
} else { | ||
process.env[item[0]] = item[1]; | ||
} | ||
mockEnvs = []; | ||
} | ||
return this; | ||
}; |
{ | ||
"name": "mm", | ||
"version": "1.3.3", | ||
"version": "1.3.4", | ||
"description": "mock mate, mock http request, fs access and so on.", | ||
@@ -12,8 +12,5 @@ "main": "index.js", | ||
"test": "npm run lint && mocha --check-leaks -R spec -t 5000 -r should-http -r co-mocha test/*.test.js", | ||
"test-cov": "istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should-http -r co-mocha test/*.test.js", | ||
"test-travis": "npm run lint && istanbul cover node_modules/.bin/_mocha --report lcovonly -- --check-leaks -t 5000 -r should-http -r co-mocha test/*.test.js", | ||
"test-cov": "npm run lint && istanbul cover node_modules/.bin/_mocha -- --check-leaks -t 5000 -r should-http -r co-mocha test/*.test.js", | ||
"lint": "eslint lib test index.js", | ||
"autod": "autod -w --prefix '~'", | ||
"cnpm": "npm install --registry=https://registry.npm.taobao.org", | ||
"contributors": "contributors -f plain -o AUTHORS" | ||
"autod": "autod -w --prefix '~'" | ||
}, | ||
@@ -33,5 +30,4 @@ "dependencies": { | ||
"co-mocha": "*", | ||
"contributors": "*", | ||
"eslint": "1", | ||
"istanbul-harmony": "0", | ||
"istanbul": "0", | ||
"mocha": "*", | ||
@@ -56,4 +52,4 @@ "mocha-lcov-reporter": "*", | ||
], | ||
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.com/)", | ||
"author": "fengmk2 <fengmk2@gmail.com> (http://fengmk2.com)", | ||
"license": "MIT" | ||
} |
@@ -6,4 +6,3 @@ mm | ||
[![build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![Gittip][gittip-image]][gittip-url] | ||
[![Test coverage][codecov-image]][codecov-url] | ||
[![David deps][david-image]][david-url] | ||
@@ -16,6 +15,4 @@ [![npm download][download-image]][download-url] | ||
[travis-url]: https://travis-ci.org/node-modules/mm | ||
[coveralls-image]: https://img.shields.io/coveralls/node-modules/mm.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/node-modules/mm?branch=master | ||
[gittip-image]: https://img.shields.io/gittip/fengmk2.svg?style=flat-square | ||
[gittip-url]: https://www.gittip.com/fengmk2/ | ||
[codecov-image]: https://codecov.io/github/node-modules/mm/coverage.svg?branch=master | ||
[codecov-url]: https://codecov.io/github/node-modules/mm?branch=master | ||
[david-image]: https://img.shields.io/david/node-modules/mm.svg?style=flat-square | ||
@@ -22,0 +19,0 @@ [david-url]: https://david-dm.org/node-modules/mm |
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 2 instances 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
24238
13
481
268
4