question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

latest release broke require('sinon')

See original GitHub issue
mkdir newproj && cd newproj
npm init -y
npm i -S sinon@3.2.1
node -e 'require("sinon")'

Ouptut:

~/newproj/node_modules/just-extend/index.js:40
      throw new Error('expected object, got ' + arg);
      ^

Error: expected object, got function FakeXMLHttpRequest(config) {
    EventTargetHandler.call(this);
    this.readyState = FakeXMLHttpRequest.UNSENT;
    this.requestHeaders = {};
    this.requestBody = null;
    this.status = 0;
    this.statusText = "";
    this.upload = new EventTargetHandler();
    this.responseType = "";
    this.response = "";
    this.logError = configureLogError(config);

    if (sinonXhr.supportsTimeout) {
        this.timeout = 0;
    }

    if (sinonXhr.supportsCORS) {
        this.withCredentials = false;
    }

    if (typeof FakeXMLHttpRequest.onCreate === "function") {
        FakeXMLHttpRequest.onCreate(this);
    }
}
    at extend (~/newproj/node_modules/just-extend/index.js:40:13)
    at Object.<anonymous> (~/newproj/node_modules/nise/lib/fake-xhr/index.js:651:1)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.require (module.js:497:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (~newproj/node_modules/nise/lib/fake-server/index.js:3:15)

$ npm ls just-extend
newproj@1.0.0 ~/newproj
└─┬ sinon@3.2.1
  └─┬ nise@1.1.1
    └── just-extend@1.1.24 

$ node --version
v6.11.0

Re: sinonjs/sinon#1591

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:12
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

7reactions
angus-ccommented, Oct 22, 2017

Very sorry for this. Latest just-extend has the fix (v1.1.26)

1reaction
camjacksoncommented, Oct 23, 2017

Thanks for fixing it so quickly @angus-c 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

AMD: Built version from master is broken · Issue #555 - GitHub
I was installing the latest pre-built version from sinon.org. I'll just start working my way back releases until I find one that works....
Read more >
Changelog - Sinon.JS
The major release is caused by removing old mistakes and upgrading dependencies that themselves have had new major releases. Upgrade nise, @sinonjs/formatio, @ ......
Read more >
Mocking with Sinon against a service module - Stack Overflow
You can see that my createUser method takes a user Object as a parameter and passes this to a database module where it...
Read more >
Why isn't my Stub working (Using Sinon Stubs — part II)
This post tells the mysterious story of a Sinon stub that refused to work...
Read more >
karma-sinon-chai - npm
Fixed broken Sinon dependency · Updated depenencies. Chai: ~3.0 => ~3.2.0; Sinon: ~1.15.0 => ~1.16.0 · Removed lodash dependency ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found