UNPKG

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