Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What are alternatives for Sinon.js (JS mocking library)?

Are there any worthwhile alternatives for Sinon.js?

Thanks.

like image 708
WHITECOLOR Avatar asked Nov 04 '22 20:11

WHITECOLOR


2 Answers

Testdouble.js

There is also library called testdouble.js. Which is a kind of more object-oriented than sinon.js.

Also, this article from testdouble guys explain the differences between sinon.js and testdouble.js.

Example

var td = require('testdouble');

var fetch = td.function();
td.when(fetch(42)).thenReturn('Jane User');

fetch(42); // -> 'Jane User'
like image 109
Inanc Gumus Avatar answered Nov 15 '22 13:11

Inanc Gumus


Not quite as advanced, but you can look at Jack.

like image 23
Tanzeeb Khalili Avatar answered Nov 15 '22 12:11

Tanzeeb Khalili