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

bondjs

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bondjs - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

34

bond.js
// Generated by CoffeeScript 1.3.3
(function() {
var allStubs, arrayEqual, bond, createReturnSpy, createThroughSpy, enhanceSpy, registerHooks, registeredHooks,
var allStubs, arrayEqual, bond, createAnonymousSpy, createReturnSpy, createThroughSpy, enhanceSpy, registerHooks, registeredHooks,
__slice = [].slice;

@@ -35,5 +35,23 @@

createAnonymousSpy = function() {
var returnValue, spy;
returnValue = null;
spy = function() {
var args;
args = Array.prototype.slice.call(arguments);
spy.calledArgs[spy.called] = args;
spy.called++;
return returnValue;
};
enhanceSpy(spy);
spy["return"] = function(newReturnValue) {
returnValue = newReturnValue;
return spy;
};
return spy;
};
enhanceSpy = function(spy, original, bondApi) {
var k, v;
spy.prototype = original.prototype;
spy.prototype = original != null ? original.prototype : void 0;
spy.called = 0;

@@ -50,5 +68,7 @@ spy.calledArgs = [];

};
for (k in bondApi) {
v = bondApi[k];
spy[k] = v;
if (bondApi) {
for (k in bondApi) {
v = bondApi[k];
spy[k] = v;
}
}

@@ -95,3 +115,3 @@ return spy;

if (arguments.length === 0) {
return createReturnSpy(function() {});
return createAnonymousSpy();
}

@@ -135,3 +155,3 @@ registerHooks();

bond.version = '0.0.8';
bond.version = '0.0.9';

@@ -138,0 +158,0 @@ if (typeof window !== "undefined" && window !== null) {

{
"name": "bondjs",
"version": "0.0.8",
"version": "0.0.9",
"description": "simple js stub/spy library",

@@ -5,0 +5,0 @@ "main": "bond.js",

@@ -6,4 +6,2 @@ bond: the simple stub/spy javascript library

the api is simple:
bond api

@@ -14,8 +12,14 @@ ====

`bond#to(value)` replaces the value with a new value
`bond()` returns an anonymous spy
`bond#return(value)` replaces the value with a spy that returns the given value
`bond().return(value)` returns an anonymous spy that returns the given value when called
`bond#to(value)` replaces the value with a new value; reverts the stub after the current test completes
`bond#return(value)` replaces the value with a spy that returns the given value; reverts the spy after the current test completes
`bond#through()` replaces the value with a spy, but allows it to return its normal value
`bond#restore()` replaces a spy/stub with its original value; useful for implementing your own `cleanup` handler (see below)
bond spies

@@ -37,2 +41,8 @@ ====

**with mocha, qunit, jasmine**: These frameworks should work with bond as is. Bond looks for a global function named either `afterEach` or `testDone` to implement its spy/stub restore functionality. If those exist, as they should when using these frameworks, it should work fine.
**with some other test runner**: You may need to implement your own `cleanup` method for bond to work properly. This might look like the following.
`bond.cleanup = someTestRunner.registerAfterCallback`
tests

@@ -39,0 +49,0 @@ ===

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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