Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Example JSPM/Jasmine/Karma file
// The directory structure for this config is as follows:
// config.js
// client/
// app/
// ...(all app code)...
// spec/
// karma.conf.js [THIS FILE]
// spec_helpers.js
// app/
// ...(all app specs)...
module.exports = function(config) {
basePath: '../..',
frameworks: ['jspm', 'jasmine-ajax', 'jasmine'],
jspm: {
// These files are loaded when Karma is run.
loadFiles: [
// These files are in the import path (for ES6 modules).
serveFiles: ['client/app/scripts/**/*.js', 'client/spec/spec_helpers.js']
// When SystemJS looks for a file (e.g. '/app/main.js'), it uses the 'real' URL. However,
// Karma puts all of your files at a /base root (the file above is at /base/app/main.js),
// so we need to set up a proxy to access these files.
proxies: {
'/client': '/base/client',
'/spec': '/base/client/spec', // Shorthand for specs: import { abc } from 'spec/spec_helpers'
'/jspm_packages': '/base/jspm_packages',
'/config.js': '/base/config.js',
'/app': '/base/client/app/scripts' // Shorthand for specs: import Subject from 'app/subject'
// We need to transpile our tests to ES5 before running them.
preprocessors: {
'client/spec/**/*.js': ['babel']
babelPreprocessor: {
options: {
sourceMap: 'inline',
modules: 'system'
reporters: ['dots'],
logLevel: config.LOG_INFO,
autoWatch: false,
browsers: ['PhantomJS'],
singleRun: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment