Skip to content

Instantly share code, notes, and snippets.

View mroderick's full-sized avatar

Morgan Roderick mroderick

View GitHub Profile
@mroderick
mroderick / sinon-array-test.js
Created August 9, 2017 08:24
A sample which shows that you cannot stub the `Array.prototype.filter` method. All works fine for `Array.prototype.map`.
'use strict';
const sinon = require( 'sinon' );
const expect = require( 'chai' ).expect;
describe( 'Array.prototype', () => {
describe( 'map()', () => {
it( 'uses native map', () => {
const callback = sinon.spy();
const stub = sinon.stub( Array.prototype, 'map' ).returns( [ 2, 4 ] );
@mroderick
mroderick / README.md
Last active July 18, 2018 14:16
Firefox debugger bug

Firefox debugger bug

When using the debugger and re-using an argument name in a chain of promises, the debugger displays the second argument as undefined().

Try running the examples in Firefox and compare what the debugger displays about the argument to the second callback.

@mroderick
mroderick / dependencies.md
Created February 20, 2020 12:41
Sinon library inter-dependencies

Sinon library inter-dependencies

These diagrams show how the Sinon family of libraries depend on each other. devDependencies are omitted, as they can be considering "internal", and shouldn't be installed by end users of sinon or referee

Sinon

┌────────────────────────┐                                                                                               
│    @sinonjs/commons    │◀──────────────────────────────────────────────────┐