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

a_mock

Package Overview
Dependencies
Maintainers
2
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

a_mock - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

10

expectRequire.js

@@ -6,3 +6,2 @@ var mod = require('module');

function loadHook(request,parent,isMain) {

@@ -16,2 +15,11 @@ return partialMock(request,parent,isMain);

loadHook._aClearMocks = function(){
mod._load = originalLoad;
if (mod._load._aClearMocks)
mod._load._aClearMocks();
};
expect.clear = loadHook._aClearMocks;
module.exports = expect;

@@ -43,1 +43,19 @@ var sut = require('../expectRequire');

})();
(function(){
console.log('expectRequire clear');
(function() {
console.log('require');
sut('./foo').return(fooFake);
sut.clear();
var returned = require('./foo');
test('it should execute returns real foo', function(){
assert.notEqual(fooFake,returned);
});
})();
})();

2

package.json
{
"name": "a_mock",
"version": "0.0.8",
"version": "0.0.9",
"main": "index.js",

@@ -5,0 +5,0 @@ "title": "a_mock",

@@ -10,4 +10,6 @@ var newMock = require('./mock');

create.clear = expectRequire.clear;
module.exports = create;

@@ -8,2 +8,3 @@ var assert = require('assert');

var expectRequireMock = newMock();
expectRequireMock.clear = {};

@@ -25,5 +26,5 @@ expectRequire('./mock').return(newMockMock);

returnMock.expect(mock).whenCalled(onReturnMock).return(null);
var sut = require('../requireMock');
var returned = sut(moduleName);
var returned = require('../requireMock')(moduleName);
function onReturnMock() {

@@ -41,2 +42,7 @@ didExpectRequireReturnMock = true;

test('clear should point at expectRequire.clear',function(){
assert.equal(sut.clear, expectRequireMock.clear);
});
})();
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