Quantcast
Channel: Chutzpah - A JavaScript Test Runner
Viewing all articles
Browse latest Browse all 1864

Commented Issue: 'undefined' is not a function after updating to 2.3 [96]

$
0
0
The new version of Chutzpah seems to be having trouble resolving references. I have paths to both jQuery and underscore, and it cannot find them even though they are correct. Running them in the browser with the Visual Studio Chutzpah add-in works fine. All tests worked fine in version 2.2.

```
JS Error: ReferenceError: Can't find variable: _
in file:///c:/projects/.../scripts/libs/plugins.js (line 495)
in file:///c:/projects/.../scripts/libs/plugins.js (line 658)
While Running:c:\projects\...\scripts\test\libs\plugins\tests.js
```

```
Test 'DateUtil:should format date and time' failed
Died on test #1 at file:///C:/Users/.../AppData/Local/Microsoft/VisualStudio/11.0/Extensions/xk1wwyp0.j5k/TestFiles/QUnit/qunit.js:343
at file:///C:/Projects/.../Scripts/test/libs/plugins/tests.js:39
at file:///C:/Projects/.../Scripts/test/libs/plugins/tests.js:41: 'undefined' is not a function (evaluating '$.substitute')
in C:\Projects\...\Scripts\test\libs\plugins\tests.js (line 34)
```

Here is what the test file looks like:
```
/// <reference path="../../../libs/jquery/jquery.js" />
/// <reference path="../../../libs/underscore/underscore.js" />
/// <reference path="../../qunit.js" />
/// <reference path="../../../libs/plugins.js" />

/*jshint browser:true, jquery:true */
/*global _, test, module, equal */

(function ($) {

module('$.substitute');

test('should replace named tokens in string', function () {
...
});

module('DateUtil');

test('should format date and time', function () {
...
});

})(jQuery);
```

Here is the file structure
```
Scripts\
libs\
underscore\
underscore.js
jquery\
jquery.js
plugins.js
test\
libs\
plugins\
tests.js
ui.html
```

Here is what the plugins file looks like
```
/// <reference path="jquery/jquery.js" />
/// <reference path="underscore/underscore.js" />
/// <reference path="knockout/knockout.js" />
/// <reference path="datepicker/bootstrap-datepicker.js" />
...

/*jshint browser: true, jquery: true*/
/*global _, ko, setTimeout, Log */

DateUtil = {

formatDate: function (date, formatString) {
...
}
};

(function ($) {
...

$.substitute = function(str, sub) {
...
};

})(jQuery);
```
Comments: Any additional information I can provide or help with?

Viewing all articles
Browse latest Browse all 1864

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>