simple-spy
yet another spy library
Last updated a year ago by tjoskar .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install simple-spy 
SYNC missed versions from official npm registry.

simple-spy Build Status Coverage Status

yet another spy library

Install

$ npm install --save simple-spy

Usage

import { spy } from 'simple-spy'

const fun = (...args) => console.log(...args)
const funSpy = spy(fun)

assert(funSpy.callCount === 0)
assert(funSpy.args.length === 0)

funSpy('Hello Dexter Morgan') // Output:  Hello Dexter Morgan

assert(funSpy.callCount === 1)
assert(funSpy.args.length === 1)
assert(funSpy.args[0][0] === 'Hello Dexter Morgan')

funSpy.reset()

funSpy(1, 2, 3) // Output:  1 2 3

assert(funSpy.callCount === 1)
assert(funSpy.args.length === 1)
assert(funSpy.args[0].length === 3)
assert(funSpy.args[0][0] === 1)
assert(funSpy.args[0][1] === 2)
assert(funSpy.args[0][2] === 3)

API

spy(fun)

fun

Type: function

License

MIT © Oskar Karlsson

Current Tags

  • 3.0.1                                ...           latest (a year ago)

14 Versions

  • 3.0.1                                ...           a year ago
  • 3.0.0                                ...           a year ago
  • 2.2.1                                ...           3 years ago
  • 2.2.0                                ...           3 years ago
  • 2.1.0                                ...           4 years ago
  • 2.0.4                                ...           4 years ago
  • 2.0.3                                ...           4 years ago
  • 2.0.2                                ...           4 years ago
  • 2.0.1                                ...           4 years ago
  • 2.0.0                                ...           4 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 14
This Month 28
Last Day 14
Last Week 14
Last Month 15
Dependencies (0)
None

Copyright 2014 - 2016 © taobao.org |