https://github.com/coderaiser/sinon-called-with-diff
add diff to calledWith output of sinon
https://github.com/coderaiser/sinon-called-with-diff
called-with diff javascript mock sinon stub tdd test
Last synced: 3 months ago
JSON representation
add diff to calledWith output of sinon
- Host: GitHub
- URL: https://github.com/coderaiser/sinon-called-with-diff
- Owner: coderaiser
- License: mit
- Created: 2017-04-07T08:18:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2018-11-29T14:27:16.000Z (almost 7 years ago)
- Last Synced: 2025-05-24T10:50:34.187Z (5 months ago)
- Topics: called-with, diff, javascript, mock, sinon, stub, tdd, test
- Language: JavaScript
- Size: 30.3 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: ChangeLog
- License: LICENSE
Awesome Lists containing this project
README
# Sinon called with diff [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]
Add ability to show diff when args are different in [sinon](https://sinonjs.org "sinon").
You can also replace `sinon` with [stub](https://github.com/cloudcmd/stub) wich is drop-in replacement of `sinon.stub()` with diff support.## Install
```
npm i sinon sinon-called-with-diff --save
```## How to use?
```js
const diff = require('sinon-called-with-diff');
const sinon = diff(require('sinon'));const stub = sinon.stub();
stub('hello');
stub.calledWith('world');
// returns
false
```Will produce output:
```sh
wrong arguments in functionStub
actual: [
"hello"
]expected: [
"world"
]
```## License
MIT
[NPMIMGURL]: https://img.shields.io/npm/v/sinon-called-with-diff.svg?style=flat
[BuildStatusIMGURL]: https://img.shields.io/travis/coderaiser/sinon-called-with-diff/master.svg?style=flat
[DependencyStatusIMGURL]: https://img.shields.io/david/coderaiser/sinon-called-with-diff.svg?style=flat
[LicenseIMGURL]: https://img.shields.io/badge/license-MIT-317BF9.svg?style=flat
[NPMURL]: https://npmjs.org/package/sinon-called-with-diff "npm"
[BuildStatusURL]: https://travis-ci.org/coderaiser/sinon-called-with-diff "Build Status"
[DependencyStatusURL]: https://david-dm.org/coderaiser/sinon-called-with-diff "Dependency Status"
[LicenseURL]: https://tldrlegal.com/license/mit-license "MIT License"[CoverageURL]: https://coveralls.io/github/coderaiser/sinon-called-with-diff?branch=master
[CoverageIMGURL]: https://coveralls.io/repos/coderaiser/sinon-called-with-diff/badge.svg?branch=master&service=github