2014-05-17 19:17:09 +00:00
|
|
|
// If there's something broken in filer or a test,
|
|
|
|
// requirejs can blow up, and mocha sees it as tests
|
|
|
|
// not getting added (i.e., it just exists with only
|
2014-05-23 00:19:24 +00:00
|
|
|
// 1 test run). Display an error and crash loudly
|
|
|
|
// so it's clear what happened.
|
2014-05-17 19:17:09 +00:00
|
|
|
process.on('uncaughtException', function(err) {
|
2014-05-23 00:19:24 +00:00
|
|
|
describe('requirejs errors: ', function() {
|
|
|
|
it('requirejs has crashed building the test suite...', function(done) {
|
|
|
|
console.error(err.stack);
|
|
|
|
require('assert').ok(false);
|
|
|
|
});
|
|
|
|
});
|
2014-05-17 19:17:09 +00:00
|
|
|
});
|
2014-05-16 16:37:34 +00:00
|
|
|
|
2014-05-17 19:17:09 +00:00
|
|
|
var requirejs = require('requirejs');
|
2014-05-16 16:37:34 +00:00
|
|
|
requirejs.config({
|
|
|
|
paths: {
|
|
|
|
"tests": "../tests",
|
|
|
|
"src": "../src",
|
|
|
|
"spec": "../tests/spec",
|
|
|
|
"bugs": "../tests/bugs",
|
|
|
|
"util": "../tests/lib/test-utils",
|
2014-05-17 18:44:29 +00:00
|
|
|
// see gruntfile.js for how dist/filer-test.js gets built
|
2014-05-21 17:06:37 +00:00
|
|
|
"Filer": "../dist/filer_node-test"
|
2014-05-16 16:37:34 +00:00
|
|
|
},
|
|
|
|
baseUrl: "./lib",
|
|
|
|
optimize: "none",
|
|
|
|
shim: {
|
|
|
|
// TextEncoder and TextDecoder shims. encoding-indexes must get loaded first,
|
|
|
|
// and we use a fake one for reduced size, since we only care about utf8.
|
|
|
|
"encoding": {
|
|
|
|
deps: ["encoding-indexes-shim"]
|
|
|
|
}
|
|
|
|
},
|
|
|
|
nodeRequire: require
|
|
|
|
});
|
|
|
|
|
2014-05-17 19:17:09 +00:00
|
|
|
// We use Chai's expect assertions in all the tests via a global
|
2014-05-16 16:37:34 +00:00
|
|
|
GLOBAL.expect = require('chai').expect;
|
|
|
|
|
2014-05-17 19:17:09 +00:00
|
|
|
// Workaround for Mocha bug, see https://github.com/visionmedia/mocha/issues/362
|
2014-05-16 17:18:13 +00:00
|
|
|
describe("Mocha needs one test in order to wait on requirejs tests", function() {
|
|
|
|
it('should wait for other tests', function(){
|
|
|
|
require('assert').ok(true);
|
2014-05-16 16:37:34 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2014-05-16 17:18:13 +00:00
|
|
|
requirejs(["tests/test-manifest"]);
|