2013-11-27 17:18:09 +00:00
|
|
|
/**
|
2014-01-21 21:25:09 +00:00
|
|
|
* Add spec files to the list in test-manifest.js
|
2013-11-27 17:18:09 +00:00
|
|
|
*/
|
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
// Dynamically figure out which source to use (dist/ or src/) based on
|
|
|
|
// query string:
|
|
|
|
//
|
|
|
|
// ?filer-dist/filer.js --> use dist/filer.js
|
|
|
|
// ?filer-dist/filer.min.js --> use dist/filer.min.js
|
|
|
|
// ?<default> --> (default) use src/filer.js with require
|
|
|
|
var filerArgs = window.filerArgs = {};
|
|
|
|
var config = (function() {
|
|
|
|
var query = window.location.search.substring(1);
|
|
|
|
query.split('&').forEach(function(pair) {
|
|
|
|
pair = pair.split('=');
|
|
|
|
var key = decodeURIComponent(pair[0]);
|
|
|
|
var value = decodeURIComponent(pair[1]);
|
|
|
|
if(key.indexOf('filer-') === 0) {
|
|
|
|
filerArgs[ key.replace(/^filer-/, '') ] = value;
|
2013-11-27 18:08:26 +00:00
|
|
|
}
|
2014-01-21 21:25:09 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
// Support dist/filer.js
|
|
|
|
if(filerArgs['filer-dist/filer.js']) {
|
|
|
|
return {
|
|
|
|
paths: {
|
|
|
|
"tests": "../tests",
|
|
|
|
"spec": "../tests/spec",
|
|
|
|
"bugs": "../tests/bugs",
|
|
|
|
"util": "../tests/lib/test-utils",
|
|
|
|
"Filer": "../dist/filer"
|
|
|
|
},
|
|
|
|
baseUrl: "../lib",
|
|
|
|
optimize: "none"
|
|
|
|
};
|
2013-11-27 18:08:26 +00:00
|
|
|
}
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
// Support dist/filer.min.js
|
|
|
|
if(filerArgs['filer-dist/filer.min.js']) {
|
|
|
|
return {
|
|
|
|
paths: {
|
|
|
|
"tests": "../tests",
|
|
|
|
"spec": "../tests/spec",
|
|
|
|
"bugs": "../tests/bugs",
|
|
|
|
"util": "../tests/lib/test-utils",
|
|
|
|
"Filer": "../dist/filer.min"
|
|
|
|
},
|
|
|
|
baseUrl: "../lib",
|
|
|
|
optimize: "none"
|
|
|
|
};
|
|
|
|
}
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
// Support src/ filer via require
|
|
|
|
return {
|
|
|
|
paths: {
|
|
|
|
"tests": "../tests",
|
|
|
|
"src": "../src",
|
|
|
|
"spec": "../tests/spec",
|
|
|
|
"bugs": "../tests/bugs",
|
|
|
|
"util": "../tests/lib/test-utils",
|
|
|
|
"Filer": "../src/index"
|
|
|
|
},
|
|
|
|
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"]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|
|
|
|
}());
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
require.config(config);
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
// Intentional globals
|
|
|
|
assert = chai.assert;
|
|
|
|
expect = chai.expect;
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
// We need to setup describe() support before loading tests
|
|
|
|
mocha.setup("bdd");
|
2013-11-27 17:18:09 +00:00
|
|
|
|
2014-01-21 21:25:09 +00:00
|
|
|
require(["tests/test-manifest"], function() {
|
2013-11-27 17:18:09 +00:00
|
|
|
window.onload = function() {
|
2014-01-21 21:25:09 +00:00
|
|
|
mocha.checkLeaks();
|
|
|
|
mocha.run();
|
2013-11-27 17:18:09 +00:00
|
|
|
};
|
|
|
|
});
|