computmaxer / karma-jspm

Other
74 stars 50 forks source link

Can't find SystemJS #64

Closed dmackerman closed 9 years ago

dmackerman commented 9 years ago

Update: this all works if I downgrade to System 0.16.*

Few facts:

Spent a few hours trying to debug this, and I think my setup is pretty standard. Folder structure here:

| root
| - /jspm_packages
| - /node_modules
| - /src
| --   /app <- all app code here
| ---      system.config.js <-- SystemJS config file.
| - /test
| --   /unit <- all test code here
| - karma.conf.js

Snippet from my system.config.js:

System.config({
  "baseURL": "",
  "transpiler": "babel",
  "babelOptions": {
    "optional": [
      "runtime"
    ]
  },
  "paths": {
    "*": "*.js",
    "github:*": "../jspm_packages/github/*.js",
    "npm:*": "../jspm_packages/npm/*.js"
  },
  "defaultJSExtensions": true
});

My karma config:

module.exports = function(config) {
    config.set({

        // base path that will be used to resolve all patterns (eg. files, exclude)
        basePath: '',
        frameworks: ['jspm', 'jasmine'],
        browserNoActivityTimeout: 20000,
        browsers: ['PhantomJS'],
        reporters: ['spec', 'coverage'],
        singleRun: true,
        colors: true,

        jspm: {
            config: 'src/app/system.config.js',
            loadFiles: [
                'node_modules/phantomjs-polyfill/bind-polyfill.js',
                'test/unit/**/*.js'
            ],
            serveFiles: [
                'src/app/**/*.js'
            ]
        },

        proxies: {
            '/jspm_packages': '/base/jspm_packages'
        },

        // list of files to exclude
        exclude: [],

        logLevel: config.LOG_ERROR,

        preprocessors: {
            'test/unit/**/*.js': ['babel', 'coverage'],
            'src/app/**/*.js': ['babel', 'coverage']
        },

        babelPreprocessor: {
            options: {
                modules: 'system',
                compact: false
            }
        },

        coverageReporter: {
            // specify a common output directory
            dir: 'coverage/',
            reporters: [{
                type: 'html',
                subdir: 'report-html'
            }, {
                type: 'lcov',
                subdir: 'report-lcov'
            }]
        }

    });
};

The error I get when running karma (local version, from /client) ./node_modules/.bin/karma start karma.config.js is this:

PhantomJS 1.9.8 (Mac OS X 0.0.0) ERROR
  TypeError: 'undefined' is not a function (evaluating 'System.register')
  at /Users/dave/Sites/kickstart-app/client/src/app/system.config.js:9

PhantomJS 1.9.8 (Mac OS X 0.0.0): Executed 0 of 0 ERROR (0.1 secs / 0 secs)

It seems that System is undefined, which means that it's not loading? Seems to be a path issue, but I surely cannot figure this out for the life of me...

maxwellpeterson-wf commented 9 years ago

I believe this is fixed by #61 which was just released in karma-jspm@2.0.0-beta.1

Could you try it with that version?

dmackerman commented 9 years ago

I reverted to an old version, but I'll give it a shot. Thanks.