2014-02-03 16:48:04 +01:00
|
|
|
global.assert = require('assert');
|
2016-06-29 20:23:26 +02:00
|
|
|
require('third/string-prototype-codepointat/codepointat.js');
|
2013-08-20 06:15:41 +02:00
|
|
|
|
2014-02-01 15:44:52 +01:00
|
|
|
global.Dict = require('js/dict');
|
|
|
|
global._ = require('third/underscore/underscore.js');
|
|
|
|
var _ = global._;
|
|
|
|
|
2016-07-30 18:14:42 +02:00
|
|
|
// Find the files we need to run.
|
|
|
|
var finder = require('./finder.js');
|
|
|
|
var files = finder.find_files_to_run(); // may write to console
|
|
|
|
if (_.isEmpty(files)) {
|
|
|
|
throw "No tests found";
|
|
|
|
}
|
|
|
|
|
2016-07-30 17:00:12 +02:00
|
|
|
// Set up our namespace helpers.
|
|
|
|
var namespace = require('./namespace.js');
|
|
|
|
global.set_global = namespace.set_global;
|
|
|
|
global.patch_builtin = namespace.patch_builtin;
|
|
|
|
global.add_dependencies = namespace.add_dependencies;
|
2016-07-30 20:01:15 +02:00
|
|
|
global.stub_out_jquery = namespace.stub_out_jquery;
|
2016-07-30 17:00:12 +02:00
|
|
|
|
2016-07-30 17:18:38 +02:00
|
|
|
// Set up helpers to render templates.
|
|
|
|
var render = require('./render.js');
|
|
|
|
global.use_template = render.use_template;
|
|
|
|
global.make_sure_all_templates_have_been_compiled = render.make_sure_all_templates_have_been_compiled;
|
|
|
|
|
2016-07-30 17:38:55 +02:00
|
|
|
// Set up helpers to output HTML
|
|
|
|
var output = require('./output.js');
|
|
|
|
global.write_handlebars_output = output.write_handlebars_output;
|
|
|
|
global.write_test_output = output.write_test_output;
|
|
|
|
global.append_test_output = output.append_test_output;
|
|
|
|
|
2016-08-05 21:42:19 +02:00
|
|
|
var noop = function () {};
|
2013-08-21 23:53:00 +02:00
|
|
|
|
2016-07-30 17:38:55 +02:00
|
|
|
output.start_writing();
|
2014-01-17 18:23:39 +01:00
|
|
|
|
2016-07-30 18:14:42 +02:00
|
|
|
files.forEach(function (file) {
|
2016-08-05 21:42:19 +02:00
|
|
|
global.patch_builtin('setTimeout', noop);
|
|
|
|
global.patch_builtin('setInterval', noop);
|
|
|
|
|
2016-07-30 18:14:42 +02:00
|
|
|
console.info('running tests for ' + file.name);
|
2016-08-25 03:58:13 +02:00
|
|
|
render.init();
|
2016-07-30 18:14:42 +02:00
|
|
|
require(file.full_name);
|
2016-07-30 17:00:12 +02:00
|
|
|
namespace.restore();
|
2013-08-20 06:15:41 +02:00
|
|
|
});
|
2013-11-27 17:23:13 +01:00
|
|
|
|
2016-07-30 18:14:42 +02:00
|
|
|
console.info("To see more output, open " + output.index_fn);
|