computmaxer / karma-jspm

Other
74 stars 50 forks source link

Try to use it with plugin-typescript, may be problem is at your site. #112

Closed comdiv closed 8 years ago

comdiv commented 8 years ago

I try to do following: Project structure:

./jspm/... # jspm modules
./src/
    test.ts
./config-jspm-karma.js  # jspm config for Karma './base' provided
./karma.conf.js #karma config

Expected:

  karma start

And project is tested with JSPM/SystemJS loader and from source, scripted in TypeScript without precompile

In .config-jspm-karma.js :


System.config({
  baseURL: "./base", // i think it's required for Karma - isn't it ?
  "transpiler": false,
  "packages": {
    "src": {
        "main": "t.ts",
      "defaultExtension": "ts",
      "meta": {
        "*.ts": {
          "loader": "ts"
        },
        "*.js": {
          "loader": "ts"
        }
      }
    }
  },
  paths: {
    "npm:*": "jspm/npm/*",
    "github:*": "jspm/github/*"
  },

  map: {
    "ts": "github:frankwallis/plugin-typescript@2.2.3",
    "typescript": "npm:typescript@1.6.2",
    "github:frankwallis/plugin-typescript@2.2.3": {
      "typescript": "npm:typescript@1.6.2"
    }
  }
});

In ./karma.conf.js

// Karma configuration
// Generated on Mon Nov 30 2015 02:58:44 GMT+0500 (RTZ 4 (зима))

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

    // base path that will be used to resolve all patterns (eg. files, exclude)
    basePath: '',
    frameworks: ['jspm','jasmine'],

    plugins:[
        "karma-jspm",
        'karma-jasmine',
        'karma-chrome-launcher',
        'karma-jasmine-html-reporter'
        ],

    jspm: {
        config: "./config-jspm-karma.js",
        loadFiles: ['src/test.ts'],
        packages: "jspm/"
    }   ,

    // test results reporter to use
    // possible values: 'dots', 'progress'
    // available reporters: https://npmjs.org/browse/keyword/karma-reporter
    reporters: ['progress','html'],

    // web server port
    port: 9876,

    // enable / disable colors in the output (reporters and logs)
    colors: true,

    // level of logging
    // possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
    logLevel: config.LOG_INFO,

    // enable / disable watching file and executing tests whenever any file changes
    autoWatch: true,

    // start these browsers
    // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
    browsers: ['Chrome'],

    // Continuous Integration mode
    // if true, Karma captures browsers, runs the tests and exits
    singleRun: false,

    // Concurrency level
    // how many browser should be started simultanous
    concurrency: Infinity
  })
}

For first look all is well, but when i try to launch it in karma - i catch following:

Chrome 46.0.2490 (Windows 10 0.0.0) ERROR: 'Potentially unhandled rejection [6]
Error: XHR error (404 Not Found) loading http://localhost:9876/base/jspm/github/frankwallis/plugin-typescript@2.2.3
    at error (http://localhost:9876/base/jspm/system.src.js?6536115be64e0ff966e
5546f7767676fa7c03d6:1020:16)
    at XMLHttpRequest.xhr.onreadystatechange (http://localhost:9876/base/jspm/s
stem.src.js?6536115be64e0ff966e05546f7767676fa7c03d6:1028:13)'

I have post this at https://github.com/frankwallis/plugin-typescript/issues/64 while i'm not sure what does provide this error exactly.

I have assured that http://localhost:9876/base/jspm/github/frankwallis/plugin-typescript@2.2.3/utils.js is accessible for example and not completly understand why it trys to load whole plugin.

comdiv commented 8 years ago

Have found mistake ourselves: "defaultJSExtensions": true, was not in .\config.js