Commit cb9a1673 authored by JC Brand's avatar JC Brand

Clean up test runner config and remove unnecessary stuff

parent 7a990ae0
var config = { var config = {
baseUrl: '../', baseUrl: '../',
paths: { paths: {
"console-reporter": "tests/console-reporter", 'console-reporter': 'tests/console-reporter',
"es6-promise": "node_modules/es6-promise/dist/es6-promise.auto", 'es6-promise': 'node_modules/es6-promise/dist/es6-promise.auto',
"jquery": "node_modules/jquery/dist/jquery", 'jasmine-console': 'node_modules/jasmine-core/lib/console/console',
"lodash": "node_modules/lodash/lodash", 'jasmine-core': 'node_modules/jasmine-core/lib/jasmine-core/jasmine',
"lodash.converter": "3rdparty/lodash.fp", 'jasmine-html': 'node_modules/jasmine-core/lib/jasmine-core/jasmine-html',
"lodash.fp": "src/lodash.fp", 'jasmine':'node_modules/jasmine-core/lib/jasmine-core/boot',
"lodash.noconflict": "node_modules/@converse/headless/lodash.noconflict", 'mock': 'tests/mock',
"pluggable": "node_modules/pluggable.js/dist/pluggable", 'sinon': 'node_modules/sinon/pkg/sinon',
"sizzle": "node_modules/sizzle/dist/sizzle", 'test-utils': 'tests/utils',
"underscore": "src/underscore-shim", '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: { shim: {
'backbone.orderedlistview': { deps: ['backbone.nativeview'] }, 'jasmine-html': {
'backbone.overview': { deps: ['backbone.nativeview'] }, deps: ['jasmine-core'],
'backbone.vdomview': { deps: ['backbone.nativeview'] }, exports: 'window.jasmineRequire'
'emojione': { exports: 'emojione'}, },
'xss': { 'jasmine-console': {
'init': function (xss_noconflict) { deps: ['jasmine-core'],
return { exports: 'window.jasmineRequire'
filterXSS: window.filterXSS, },
filterCSS: window.filterCSS '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); require.config(config);
var specs = [ var specs = [
...@@ -121,18 +64,14 @@ var specs = [ ...@@ -121,18 +64,14 @@ var specs = [
"spec/http-file-upload" "spec/http-file-upload"
]; ];
require(['console-reporter', 'mock', 'sinon', 'wait-until-promise', 'pluggable'], require(['console-reporter', 'mock', 'sinon', 'wait-until-promise'], (ConsoleReporter, mock, sinon, waitUntilPromise) => {
function(ConsoleReporter, mock, sinon, waitUntilPromise, pluggable) {
if (window.view_mode) { if (window.view_mode) {
mock.view_mode = window.view_mode; mock.view_mode = window.view_mode;
} }
window.sinon = sinon; window.sinon = sinon;
window.waitUntilPromise = waitUntilPromise.default; window.waitUntilPromise = waitUntilPromise.default;
window.localStorage.clear();
window.sessionStorage.clear();
// Load the specs // Load the specs
require(specs, function (jasmine) { require(specs, jasmine => {
jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000; jasmine.DEFAULT_TIMEOUT_INTERVAL = 7000;
const jasmineEnv = jasmine.getEnv(); const jasmineEnv = jasmine.getEnv();
jasmineEnv.addReporter(new ConsoleReporter()); 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