Commit cb9a1673 authored by JC Brand's avatar JC Brand

Clean up test runner config and remove unnecessary stuff

parent 7a990ae0
var config = {
baseUrl: '../',
paths: {
"console-reporter": "tests/console-reporter",
"es6-promise": "node_modules/es6-promise/dist/es6-promise.auto",
"jquery": "node_modules/jquery/dist/jquery",
"lodash": "node_modules/lodash/lodash",
"lodash.converter": "3rdparty/lodash.fp",
"lodash.fp": "src/lodash.fp",
"lodash.noconflict": "node_modules/@converse/headless/lodash.noconflict",
"pluggable": "node_modules/pluggable.js/dist/pluggable",
"sizzle": "node_modules/sizzle/dist/sizzle",
"underscore": "src/underscore-shim",
'console-reporter': 'tests/console-reporter',
'es6-promise': 'node_modules/es6-promise/dist/es6-promise.auto',
'jasmine-console': 'node_modules/jasmine-core/lib/console/console',
'jasmine-core': 'node_modules/jasmine-core/lib/jasmine-core/jasmine',
'jasmine-html': 'node_modules/jasmine-core/lib/jasmine-core/jasmine-html',
'jasmine':'node_modules/jasmine-core/lib/jasmine-core/boot',
'mock': 'tests/mock',
'sinon': 'node_modules/sinon/pkg/sinon',
'test-utils': 'tests/utils',
'transcripts': 'converse-logs/converse-logs',
'wait-until-promise': 'node_modules/wait-until-promise/index'
},
map: {
// '*' means all modules will get the '*.noconflict' version
// as their dependency.
'*': {
'backbone': 'backbone.noconflict',
'lodash': 'lodash.noconflict'
},
// '*.noconflict' wants the real module
// If this line was not here, there would
// be an unresolvable cyclic dependency.
'backbone.noconflict': { 'backbone': 'backbone' },
'lodash.noconflict': { 'lodash': 'lodash' }
},
lodashLoader: {
// Configuration for requirejs-tpl
// Use Mustache style syntax for variable interpolation
root: "src/templates/",
templateSettings: {
"escape": /\{\{\{([\s\S]+?)\}\}\}/g,
"evaluate": /\{\[([\s\S]+?)\]\}/g,
"interpolate": /\{\{([\s\S]+?)\}\}/g,
// By default, template places the values from your data in the
// local scope via the with statement. However, you can specify
// a single variable name with the variable setting. This can
// significantly improve the speed at which a template is able
// to render.
"variable": 'o'
}
},
// define module dependencies for modules not using define
shim: {
'backbone.orderedlistview': { deps: ['backbone.nativeview'] },
'backbone.overview': { deps: ['backbone.nativeview'] },
'backbone.vdomview': { deps: ['backbone.nativeview'] },
'emojione': { exports: 'emojione'},
'xss': {
'init': function (xss_noconflict) {
return {
filterXSS: window.filterXSS,
filterCSS: window.filterCSS
}
}
}
'jasmine-html': {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
},
'jasmine-console': {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
},
'jasmine': {
deps: ['jasmine-core', 'jasmine-html', 'jasmine-console'],
exports: 'window.jasmine'
},
}
};
// Extra test dependencies
config.paths.mock = "tests/mock";
config.paths['wait-until-promise'] = "node_modules/wait-until-promise/index";
config.paths['test-utils'] = "tests/utils";
config.paths.sinon = "node_modules/sinon/pkg/sinon";
config.paths.transcripts = "converse-logs/converse-logs";
config.paths["jasmine-core"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine";
config.paths.jasmine = "node_modules/jasmine-core/lib/jasmine-core/boot";
config.paths["jasmine-console"] = "node_modules/jasmine-core/lib/console/console";
config.paths["jasmine-html"] = "node_modules/jasmine-core/lib/jasmine-core/jasmine-html";
config.shim.jasmine = {
exports: 'window.jasmineRequire'
};
config.shim['jasmine-html'] = {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
};
config.shim['jasmine-console'] = {
deps: ['jasmine-core'],
exports: 'window.jasmineRequire'
};
config.shim.jasmine = {
deps: ['jasmine-core', 'jasmine-html', 'jasmine-console'],
exports: 'window.jasmine'
};
require.config(config);
var specs = [
......@@ -121,18 +64,14 @@ var specs = [
"spec/http-file-upload"
];
require(['console-reporter', 'mock', 'sinon', 'wait-until-promise', 'pluggable'],
function(ConsoleReporter, mock, sinon, waitUntilPromise, pluggable) {
require(['console-reporter', 'mock', 'sinon', 'wait-until-promise'], (ConsoleReporter, mock, sinon, waitUntilPromise) => {
if (window.view_mode) {
mock.view_mode = window.view_mode;
}
window.sinon = sinon;
window.waitUntilPromise = waitUntilPromise.default;
window.localStorage.clear();
window.sessionStorage.clear();
// Load the specs
require(specs, function (jasmine) {
require(specs, jasmine => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000;
const jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(new ConsoleReporter());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment