overleaf/services/web/test/unit_frontend/src/test-main.js
Paulo Jorge Reis 217bc180ac Merge pull request #1251 from sharelatex/pr-history-labels-compare
History labels compare

GitOrigin-RevId: bd06223344e391ba8e6017ebb27bdc3920cf754c
2018-12-17 10:10:48 +00:00

34 lines
935 B
JavaScript

/* eslint-disable
no-undef,
max-len,
*/
// 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 = []
for (let file in window.__karma__.files) {
if (window.__karma__.files.hasOwnProperty(file)) {
if (
/test\/unit_frontend\/js.+(_t|T)ests\.js$/.test(file) ||
/test\/unit_frontend\/js\/mocks\/.+\.js$/.test(file)
) {
testDeps.push(file)
}
}
}
requirejs.config({
baseUrl: '/base/public/js',
paths: {
moment: 'libs/moment-2.9.0'
},
map: {
'*': {
'ide/file-tree/util/fileOperationI18nNames':
'../../test/unit_frontend/js/mocks/ide/file-tree/util/fileOperationI18nNames'
}
},
deps: testDeps,
callback: window.__karma__.start
})