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

mm

Package Overview
Dependencies
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mm - npm Package Compare versions

Comparing version 0.1.4 to 0.1.5

7

History.md
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 @@ ==================

29

lib/mm.js

@@ -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;
};

2

LICENSE.txt
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 &lt;fengmk2@gmail.com&gt;
Copyright (c) 2012 - 2013 fengmk2 &lt;fengmk2@gmail.com&gt;

@@ -158,0 +156,0 @@ Permission is hereby granted, free of charge, to any person obtaining

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