test-main.js 935 B

12345678910111213141516171819202122232425262728293031323334
  1. /* eslint-disable
  2. no-undef,
  3. max-len,
  4. */
  5. // Set up requirejs to load the tests and mocked dependencies
  6. // For tests, uses heuristic that test filenames end with Tests.js (existing
  7. // frontend code) or _tests.js (newer frontend code)
  8. // For mocks, uses heuristic that loads any .js file within the mocks subfolder
  9. const testDeps = []
  10. for (let file in window.__karma__.files) {
  11. if (window.__karma__.files.hasOwnProperty(file)) {
  12. if (
  13. /test\/unit_frontend\/js.+(_t|T)ests\.js$/.test(file) ||
  14. /test\/unit_frontend\/js\/mocks\/.+\.js$/.test(file)
  15. ) {
  16. testDeps.push(file)
  17. }
  18. }
  19. }
  20. requirejs.config({
  21. baseUrl: '/base/public/js',
  22. paths: {
  23. moment: 'libs/moment-2.9.0'
  24. },
  25. map: {
  26. '*': {
  27. 'ide/file-tree/util/fileOperationI18nNames':
  28. '../../test/unit_frontend/js/mocks/ide/file-tree/util/fileOperationI18nNames'
  29. }
  30. },
  31. deps: testDeps,
  32. callback: window.__karma__.start
  33. })