We understand you have a problem and are in a hurry, but please provide us with some info to make it much more likely for your issue to be understood, worked on and resolved quickly.
- Sinon version : I am using github version in my package.json defined: "sinonjs/sinon"
- Environment : Windows 7 x64
- Example URL : My project is not online, but the problem I am having is with Cesium https://cesiumjs.org/
- Other libraries you are using: Loads... Karma, Chai and Cesium are the ones most relevant.
What did you expect to happen?
That a Stub of Cesium's Viewer would be produced and I could work with it.
What actually happens
TypeError: Cannot read property 'defaultDataSource' of undefined
sinon/lib/sinon/util/core/walk.js:23:0
sinon/lib/sinon/util/core/walk.js:18:0
sinon/lib/sinon/util/core/walk.js:29:0
sinon/lib/sinon/util/core/walk.js:44:0
sinon/lib/sinon/stub.js:59:0
sinon/lib/sinon/stub.js:81:0
createStubInstance crashes while walking. It gets to the 'entities' property of Cesium's Viewer and crashes with the error:
It seems to be because the property is defined as:
entities : {
get : function() {
return this._dataSourceDisplay.defaultDataSource.entities;
}
}
and this._dataSourceDisplay is undefined.
I think it's because a property is doing a little more than it should, but these things are likely to happen in some people's code and it's a 3rd party library rather than my own code.
How to reproduce
Describe _with code_ how to reproduce the faulty behaviour,
or link to code on JSBin or similar
I've had a go at this. It's not the same version of sinon but I wasn't sure how to get it working. With this version there seems to be no problem. If you let me know how to use the latest sinon like this then I will try it again.
http://jsbin.com/nipukikiqi/edit?html,js,console
@mantoni Is #1059 going to go in the 1.x branch or just the 2.0.0? If the latter, is it possible to release a sinon@next for 2.0.0 so we can begin using your fix? Currently, trying to use sinon with Angular2 breaks when you try to stub out Router and a couple other objects due to this issue.
@fatso83 Wheren't you planing to cut another sinon@next release?
If I did, I forgot 馃槼. Will do tonight.
@fatso83 no worries! You guys are doing an awesome job!
Most helpful comment
If I did, I forgot 馃槼. Will do tonight.