requirejs.config.tpl.js 782 B

12345678910111213141516171819202122232425
  1. var allTestFiles = []
  2. var TEST_REGEXP = /(spec|test)\.js$/i
  3. // Get a list of all the test files to include
  4. Object.keys(window.__karma__.files).forEach(function (file) {
  5. if (TEST_REGEXP.test(file)) {
  6. // Normalize paths to RequireJS module names.
  7. // If you require sub-dependencies of test files to be loaded as-is (requiring file extension)
  8. // then do not normalize the paths
  9. var normalizedTestModule = file.replace(/^\/base\/|\.js$/g, '')
  10. allTestFiles.push(normalizedTestModule)
  11. }
  12. })
  13. require.config({
  14. // Karma serves files under /base, which is the basePath from your config file
  15. baseUrl: '/base',
  16. // dynamically load all test files
  17. deps: allTestFiles,
  18. // we have to kickoff jasmine, as it is asynchronous
  19. callback: window.__karma__.start
  20. })