Skip to content

Tiny wrapper for spying on function calls.

License

Notifications You must be signed in to change notification settings

fabiospampinato/call-spy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

36 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

callSpy

Tiny function for spying on function calls.

Install

npm install --save call-spy

Usage

import callSpy from 'call-spy';

const [fn, result] = callSpy ( () => 'yay' );

result.called; // false
result.calls; // 0

fn ( 1, 2, 3 ); // 'yay!'

result.called; // true
result.calls; // 1
result.return; // 'yay!'
result.arguments; // [1, 2, 3]

License

MIT © Fabio Spampinato