Comparing version 0.1.4 to 0.1.5
0.1.5 / 2013-07-03 | ||
================== | ||
* hot fixed #5 mock same method twices restore fails bug | ||
* add test for fs.readFileSync. fixed #5 | ||
* support coveralls | ||
0.1.4 / 2013-05-21 | ||
@@ -3,0 +10,0 @@ ================== |
@@ -20,6 +20,21 @@ /*! | ||
exports = module.exports = function mock(obj, key, method) { | ||
// hotfix for https://github.com/fent/node-muk/pull/2 | ||
var mocks = []; | ||
var mock = module.exports = function mock(obj, key, method) { | ||
// hotfix for https://github.com/fent/node-muk/pull/2 | ||
if (typeof obj !== 'string') { | ||
mocks.push({ | ||
obj: obj, | ||
key: key, | ||
original: obj[key] | ||
}); | ||
obj[key] = method === undefined ? function () {} : method; | ||
return; | ||
} | ||
return muk.apply(null, arguments); | ||
}; | ||
exports = mock; | ||
function getCallback(args) { | ||
@@ -61,3 +76,3 @@ var index = args.length - 1; | ||
timeout = timeout || 0; | ||
muk(mod, method, function () { | ||
mock(mod, method, function () { | ||
var callback = getCallback(arguments); | ||
@@ -87,3 +102,3 @@ setTimeout(function () { | ||
} | ||
muk(mod, method, function () { | ||
mock(mod, method, function () { | ||
var callback = getCallback(arguments); | ||
@@ -325,3 +340,3 @@ setTimeout(function () { | ||
var evt = new EventEmitter(); | ||
muk(cp, 'spawn', function () { | ||
mock(cp, 'spawn', function () { | ||
return evt; | ||
@@ -344,3 +359,9 @@ }); | ||
muk.restore(); | ||
// hotfix for https://github.com/fent/node-muk/pull/2 | ||
for (var i = mocks.length - 1; i >= 0; i--) { | ||
var m = mocks[i]; | ||
m.obj[m.key] = m.original; | ||
} | ||
mocks = []; | ||
return this; | ||
}; |
This software is licensed under the MIT License. | ||
Copyright (C) 2012 by fengmk2 <fengmk2@gmail.com> | ||
Copyright (C) 2012 - 2013 by fengmk2 <fengmk2@gmail.com> | ||
@@ -5,0 +5,0 @@ Permission is hereby granted, free of charge, to any person obtaining a copy |
{ | ||
"name": "mm", | ||
"version": "0.1.4", | ||
"version": "0.1.5", | ||
"description": "mock mate, mock http request, fs access and so on.", | ||
@@ -15,3 +15,3 @@ "main": "index.js", | ||
"travis-cov": { | ||
"threshold": 100 | ||
"threshold": 99 | ||
} | ||
@@ -27,2 +27,4 @@ }, | ||
"blanket": "*", | ||
"coveralls": "*", | ||
"mocha-lcov-reporter": "*", | ||
"pedding": "*", | ||
@@ -29,0 +31,0 @@ "mocha": "*" |
@@ -1,2 +0,2 @@ | ||
mm (美眉,Mock伴侣) [![Build Status](https://secure.travis-ci.org/fengmk2/mm.png)](http://travis-ci.org/fengmk2/mm) | ||
mm (美眉,Mock伴侣) [![Build Status](https://secure.travis-ci.org/fengmk2/mm.png)](http://travis-ci.org/fengmk2/mm) [![Coverage Status](https://coveralls.io/repos/fengmk2/mm/badge.png)](https://coveralls.io/r/fengmk2/mm) | ||
======= | ||
@@ -10,4 +10,2 @@ | ||
jscoverage: [100%](http://fengmk2.github.com/coverage/mm.html) | ||
## Install | ||
@@ -141,9 +139,9 @@ | ||
project : mm | ||
repo age : 6 months | ||
active : 14 days | ||
commits : 35 | ||
repo age : 8 months | ||
active : 16 days | ||
commits : 41 | ||
files : 15 | ||
authors : | ||
32 fengmk2 91.4% | ||
3 dead-horse 8.6% | ||
37 fengmk2 90.2% | ||
4 dead-horse 9.8% | ||
``` | ||
@@ -155,3 +153,3 @@ | ||
Copyright (c) 2012 fengmk2 <fengmk2@gmail.com> | ||
Copyright (c) 2012 - 2013 fengmk2 <fengmk2@gmail.com> | ||
@@ -158,0 +156,0 @@ Permission is hereby granted, free of charge, to any person obtaining |
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
Non-existent author
Supply chain riskThe package was published by an npm account that no longer exists.
Found 1 instance in 1 package
17050
326
0
8
171