An open API service indexing awesome lists of open source software.

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

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