var _ = require('underscore');
JS.Test.describe("reduce", function() { with(this) {
it('should run rereduce', function(resume) { with(this) {
// trying to use `_` here results in the error below
}});
}});
Using var __ = require('underscore'); and using __ (double underscore subsequently) works fine.
Do JS.Test.describe() or it() have a property _ that is extracted using with(this)?
Should/could this be fixed to be compatible with canonical underscore-ish usage?
The error:
TypeError: Object function () {
var base = arguments[0],
args = [],
i, n;
for (i = 1, n = arguments.length; i < n; i++) args.push(arguments[i]);
return (typeof base === 'object' && base) ||
(typeof base === 'function' && base.apply(this, args)) ||
this;
} has no method 'range'
var base = arguments[0],
args = [],
i, n;
for (i = 1, n = arguments.length; i < n; i++) args.push(arguments[i]);
return (typeof base === 'object' && base) ||
(typeof base === 'function' && base.apply(this, args)) ||
this;
} has no method 'range'
at null.test: should run reduce (lib/tests/reduce.js:12:17)
at null.<anonymous> (node_modules/jstest/jstest.js:5102:18)
at Test.Unit.extend.TestCase.JS.Class.extend.runWithExceptionHandlers (node_modules/jstest/jstest.js:4971:16)
at Test.Unit.extend.TestCase.JS.Class.exec (node_modules/jstest/jstest.js:5101:18)
at null.<anonymous> (node_modules/jstest/jstest.js:5068:14)
at Test.Unit.extend.TestCase.JS.Class.exec (node_modules/jstest/jstest.js:5073:41)
at null.<anonymous> (node_modules/jstest/jstest.js:5115:18)
at iterate (node_modules/jstest/jstest.js:4853:49)
at ping (node_modules/jstest/jstest.js:4845:29)
at Test.Unit.extend.TestSuite.JS.Class.extend.forEach (node_modules/jstest/jstest.js:4860:9)
Hi, I have a test case that looks like this:
Using
var __ = require('underscore');
and using__
(double underscore subsequently) works fine.Do
JS.Test.describe()
orit()
have a property_
that is extracted usingwith(this)
?Should/could this be fixed to be compatible with canonical underscore-ish usage?
The error: