5 <title>Backbone Test Suite</title>
6 <link rel="stylesheet" href="../node_modules/qunitjs/qunit/qunit.css">
10 // Avoid reporting tests to Sauce Labs when script errors occur.
11 if (location.port == '9001') {
12 window.onerror = function(message) {
14 QUnit.config.done.length = 0;
16 global_test_results = { 'message': message };
20 <script src="../node_modules/qunitjs/qunit/qunit.js"></script>
21 <script src="../node_modules/qunit-extras/qunit-extras.js"></script>
22 <script src="../vendor/json-js/json2.js"></script>
23 <script src="../node_modules/platform/platform.js"></script>
24 <script src="./asset/test-ui.js"></script>
25 <script src="../lodash.js"></script>
27 QUnit.config.asyncRetries = 10;
28 QUnit.config.hidepassed = true;
30 var mixinPrereqs = (function() {
40 var lodash = _.noConflict();
43 lodash.defaultsDeep(_, { 'templateSettings': lodash.templateSettings });
44 lodash.mixin(_, lodash.pick(lodash, lodash.difference([
62 ], lodash.functions(_))));
64 lodash.forOwn(keyMap, function(realName, otherName) {
65 _[otherName] = lodash[realName];
66 _.prototype[otherName] = lodash.prototype[realName];
69 lodash.forOwn(aliasToReal, function(realName, alias) {
70 _[alias] = _[realName];
71 _.prototype[alias] = _.prototype[realName];
76 // Load prerequisite scripts.
77 document.write(ui.urlParams.loader == 'none'
78 ? '<script src="' + ui.buildPath + '"><\/script>'
79 : '<script data-dojo-config="async:1" src="' + ui.loaderPath + '"><\/script>'
83 if (ui.urlParams.loader == 'none') {
86 '<script src="../node_modules/jquery/dist/jquery.js"><\/script>',
87 '<script src="../vendor/backbone/backbone.js"><\/script>',
88 '<script src="../vendor/backbone/test/setup/dom-setup.js"><\/script>',
89 '<script src="../vendor/backbone/test/setup/environment.js"><\/script>',
90 '<script src="../vendor/backbone/test/noconflict.js"><\/script>',
91 '<script src="../vendor/backbone/test/events.js"><\/script>',
92 '<script src="../vendor/backbone/test/model.js"><\/script>',
93 '<script src="../vendor/backbone/test/collection.js"><\/script>',
94 '<script src="../vendor/backbone/test/router.js"><\/script>',
95 '<script src="../vendor/backbone/test/view.js"><\/script>',
96 '<script src="../vendor/backbone/test/sync.js"><\/script>'
103 curl.config({ 'apiName': 'require' });
105 if (!window.require) {
108 var reBasename = /[\w.-]+$/,
109 basePath = ('//' + location.host + location.pathname.replace(reBasename, '')).replace(/\btest\/$/, ''),
110 modulePath = ui.buildPath.replace(/\.js$/, ''),
111 locationPath = modulePath.replace(reBasename, '').replace(/^\/|\/$/g, ''),
112 moduleMain = modulePath.match(reBasename)[0],
115 function getConfig() {
118 'urlArgs': 't=' + uid++,
121 'backbone': '../vendor/backbone/backbone',
122 'jquery': '../node_modules/jquery/dist/jquery'
126 'location': '../vendor/backbone/test',
128 // Work around no global being exported.
130 'loader': 'curl/loader/legacy'
135 if (ui.isModularize) {
136 result.packages.push({
137 'name': 'underscore',
138 'location': locationPath,
142 result.paths.underscore = modulePath;
147 QUnit.config.autostart = false;
149 require(getConfig(), ['underscore'], function(lodash) {
150 mixinPrereqs(lodash);
151 require(getConfig(), ['backbone'], function() {
152 require(getConfig(), [
153 'test/setup/dom-setup',
154 'test/setup/environment',