2018-11-05 05:06:39 -05:00
|
|
|
/* eslint-disable
|
|
|
|
no-undef,
|
2018-12-17 04:53:20 -05:00
|
|
|
max-len,
|
2018-11-05 05:06:39 -05:00
|
|
|
*/
|
2018-12-17 04:53:20 -05:00
|
|
|
// Set up requirejs to load the tests and mocked dependencies
|
|
|
|
// For tests, uses heuristic that test filenames end with Tests.js (existing
|
|
|
|
// frontend code) or _tests.js (newer frontend code)
|
|
|
|
// For mocks, uses heuristic that loads any .js file within the mocks subfolder
|
|
|
|
const testDeps = []
|
2018-11-05 05:06:39 -05:00
|
|
|
for (let file in window.__karma__.files) {
|
|
|
|
if (window.__karma__.files.hasOwnProperty(file)) {
|
2018-12-17 04:53:20 -05:00
|
|
|
if (
|
|
|
|
/test\/unit_frontend\/js.+(_t|T)ests\.js$/.test(file) ||
|
|
|
|
/test\/unit_frontend\/js\/mocks\/.+\.js$/.test(file)
|
|
|
|
) {
|
|
|
|
testDeps.push(file)
|
2018-11-05 05:06:39 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
requirejs.config({
|
|
|
|
baseUrl: '/base/public/js',
|
|
|
|
paths: {
|
|
|
|
moment: 'libs/moment-2.9.0'
|
|
|
|
},
|
2018-12-17 04:53:20 -05:00
|
|
|
map: {
|
|
|
|
'*': {
|
|
|
|
'ide/file-tree/util/fileOperationI18nNames':
|
|
|
|
'../../test/unit_frontend/js/mocks/ide/file-tree/util/fileOperationI18nNames'
|
|
|
|
}
|
|
|
|
},
|
|
|
|
deps: testDeps,
|
2018-11-05 05:06:39 -05:00
|
|
|
callback: window.__karma__.start
|
|
|
|
})
|