jasmine: 2.5.0 Regression issue with expect().toHaveBeenCalledWith()
After installing 2.5.0, many of our tests are failing with:
PhantomJS 2.1.1 (Windows 8 0.0.0) Some test... FAILED
TypeError: undefined is not a constructor (evaluating 'allKeys[i].match(/^[0-9]+$/)') in C:/<path>/node_modules/jasmine-core/lib/jasmine-core/jasmine.js (line 2988)
c:/<path>/specFile.js:79:85
All the tests I’ve looked at so far call toHaveBeenCalledWith, e.g.:
expect(aSpy).toHaveBeenCalledWith({
someProperties: "string",
someOtherProperties: true
})
The full function that is throwing an error is:
function keys(obj, isArray) {
var allKeys = Object.keys ? Object.keys(obj) :
(function(o) {
var keys = [];
for (var key in o) {
if (has(o, key)) {
keys.push(key);
}
}
return keys;
})(obj);
if (!isArray) {
return allKeys;
}
var extraKeys = [];
for (var i in allKeys) {
if (!allKeys[i].match(/^[0-9]+$/)) {
extraKeys.push(allKeys[i]);
}
}
return extraKeys;
}
(edit)
Temporary Workaround
Lock jasmine-core to version 2.4.1 until this is addressed.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 15
- Comments: 16 (2 by maintainers)
Commits related to this issue
- Workaround Jasmine bug https://github.com/jasmine/jasmine/issues/1188 — committed to melonjs/melonJS by parasyte 8 years ago
Same here. The folllowing test fails:
Fails with
The fix should be released in v2.5.1