|
| 1 | +module.exports = function(config) { |
| 2 | + |
| 3 | + var appBase = 'app/'; // transpiled app JS files |
| 4 | + var appAssets ='base/app/'; // component assets fetched by Angular's compiler |
| 5 | + |
| 6 | + config.set({ |
| 7 | + basePath: '', |
| 8 | + frameworks: ['jasmine'], |
| 9 | + plugins: [ |
| 10 | + require('karma-jasmine'), |
| 11 | + require('karma-chrome-launcher'), |
| 12 | + require('karma-htmlfile-reporter') |
| 13 | + ], |
| 14 | + |
| 15 | + customLaunchers: { |
| 16 | + // From the CLI. Not used here but interesting |
| 17 | + // chrome setup for travis CI using chromium |
| 18 | + Chrome_travis_ci: { |
| 19 | + base: 'Chrome', |
| 20 | + flags: ['--no-sandbox'] |
| 21 | + } |
| 22 | + }, |
| 23 | + |
| 24 | + files: [ |
| 25 | + // Angular and shim libraries loaded by Karma |
| 26 | + { pattern: 'node_modules/systemjs/dist/system-polyfills.js', included: true, watched: true }, |
| 27 | + { pattern: 'node_modules/systemjs/dist/system.src.js', included: true, watched: true }, |
| 28 | + { pattern: 'node_modules/es6-shim/es6-shim.js', included: true, watched: true }, |
| 29 | + { pattern: 'node_modules/angular2/bundles/angular2-polyfills.js', included: true, watched: true }, |
| 30 | + { pattern: 'node_modules/rxjs/bundles/Rx.js', included: true, watched: true }, |
| 31 | + { pattern: 'node_modules/angular2/bundles/angular2.js', included: true, watched: true }, |
| 32 | + { pattern: 'node_modules/angular2/bundles/testing.dev.js', included: true, watched: true }, |
| 33 | + |
| 34 | + // External libraries loaded by Karma |
| 35 | + { pattern: 'node_modules/angular2/bundles/http.dev.js', included: true, watched: true }, |
| 36 | + { pattern: 'node_modules/angular2/bundles/router.dev.js', included: true, watched: true }, |
| 37 | + { pattern: 'node_modules/a2-in-memory-web-api/web-api.js', included: true, watched: true }, |
| 38 | + |
| 39 | + // Configures module loader w/ app and specs, then launch karma |
| 40 | + { pattern: 'karma-test-shim.js', included: true, watched: true }, |
| 41 | + |
| 42 | + // transpiled application & spec code paths loaded via module imports |
| 43 | + {pattern: appBase + '**/*.js', included: false, watched: true}, |
| 44 | + |
| 45 | + // asset (HTML & CSS) paths loaded via Angular's component compiler |
| 46 | + // (these paths need to be rewritten, see proxies section) |
| 47 | + {pattern: appBase + '**/*.html', included: false, watched: true}, |
| 48 | + {pattern: appBase + '**/*.css', included: false, watched: true}, |
| 49 | + |
| 50 | + // paths for debugging with source maps in dev tools |
| 51 | + {pattern: appBase + '**/*.ts', included: false, watched: false}, |
| 52 | + {pattern: appBase + '**/*.js.map', included: false, watched: false} |
| 53 | + ], |
| 54 | + |
| 55 | + // proxied base paths for loading assets |
| 56 | + proxies: { |
| 57 | + // required for component assets fetched by Angular's compiler |
| 58 | + "/app/": appAssets |
| 59 | + }, |
| 60 | + |
| 61 | + exclude: [], |
| 62 | + preprocessors: {}, |
| 63 | + reporters: ['progress', 'html'], |
| 64 | + |
| 65 | + // HtmlReporter configuration |
| 66 | + htmlReporter: { |
| 67 | + // Open this file to see results in browser |
| 68 | + outputFile: '_test-output/tests.html', |
| 69 | + |
| 70 | + // Optional |
| 71 | + pageTitle: 'Unit Tests', |
| 72 | + subPageTitle: __dirname |
| 73 | + }, |
| 74 | + |
| 75 | + port: 9876, |
| 76 | + colors: true, |
| 77 | + logLevel: config.LOG_INFO, |
| 78 | + autoWatch: true, |
| 79 | + browsers: ['Chrome'], |
| 80 | + singleRun: false |
| 81 | + }) |
| 82 | +} |
0 commit comments