/
config.js
128 lines (111 loc) · 4.4 KB
/
config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
(function() {
// This allows us to test modules without loading full player
window.__BUILD_VERSION__ = '7.8.0';
window.__FLASH_VERSION__ = 11.2;
window.__REPO__ = '';
window.__SELF_HOSTED__ = true;
window.__DEBUG__ = false;
var base = '';
var callback;
var deps = [
'phantomjs-polyfill'
];
// Add polyfills for phantomjs 1.x and IE9
if (!('atob' in window)) {
deps.push('polyfills/base64');
}
if (!('Promise' in window)) {
deps.push('polyfills/promise');
}
if (!('console' in window) || !('log' in window.console)) {
window.console = {
log: function() {
}
};
}
if (window.wallaby) {
window.wallaby.delayStart();
base = '../../';
for (var file in window.wallaby.tests) {
deps.push(window.wallaby.tests[file]);
}
callback = window.wallaby.start;
} else if (window.__karma__) {
base = '/base/';
for (var file in window.__karma__.files) {
if (/test\/unit\/[^\/]+\.js$/.test(file)) {
deps.push(file);
}
}
callback = window.__karma__.start;
} else if (window.QUnit) {
base = document.location.href.replace(/[^\/]+\/[^\/]*$/, '');
// this path is relative to the baseUrl src/js folder
deps.push('../../test/tests');
callback = window.QUnit.start;
} else if (window.requireBaseUrl || window.requireCallback) {
base = window.requireBaseUrl || base;
callback = window.requireCallback || undefined;
}
// Add qunit-fixture to page if not present
if (!document.getElementById('qunit-fixture')) {
var qunitFixture = document.createElement('div');
qunitFixture.id = 'qunit-fixture';
document.body.appendChild(qunitFixture);
}
var components = base + 'node_modules';
var data = base + 'test/data';
var mock = base + 'test/mock';
var unit = base + 'test/unit';
window.require.config({
autostart: false,
// Browserstack is very slow.
waitSeconds: 120,
// Go to open source root url
baseUrl: base + 'src/js',
paths: {
'templates': '../' + 'templates',
'css': '../' + 'css',
'handlebars': components + '/handlebars/dist/handlebars.amd',
'text': components + '/requirejs-text/text',
'handlebars-loader': components + '/requirejs-handlebars/hb',
'less': components + '/require-less/less',
'lessc': components + '/require-less/lessc',
'normalize': components + '/require-less/normalize',
'jquery': components + '/jquery/dist/jquery',
'phantomjs-polyfill': components + '/phantomjs-polyfill/bind-polyfill',
// always use test/underscore in test scripts
'test/underscore': components + '/underscore/underscore',
'data': data,
'mock': mock,
'unit': unit,
'simple-style-loader': base + 'node_modules/simple-style-loader'
},
shim: {
'test/underscore': {
exports: '_'
}
},
map: {
// make sure the text plugin is used to load templates
'*': {
'templates/displayicon.html': 'handlebars-loader!templates/displayicon.html',
'templates/dock.html': 'handlebars-loader!templates/dock.html',
'templates/logo.html': 'handlebars-loader!templates/logo.html',
'templates/player.html': 'handlebars-loader!templates/player.html',
'templates/error.html': 'handlebars-loader!templates/error.html',
'templates/rightclick.html': 'handlebars-loader!templates/rightclick.html',
'templates/slider.html': 'handlebars-loader!templates/slider.html',
'templates/menu.html': 'handlebars-loader!templates/menu.html',
'templates/playlist.html': 'handlebars-loader!templates/playlist.html',
'templates/nextup.html': 'handlebars-loader!templates/nextup.html',
'css/jwplayer.less': 'less!css/jwplayer',
'utils/video': mock + '/video.js'
}
},
// ask Require.js to load these files (all our tests)
deps: deps,
// start test run, once Require.js is done
callback: callback
});
})();