2016-05-13 82 views
0

我试图让噶/巴贝尔/茉莉/ Aurelia路上一起努力人缘运行然而,当我得到这个错误开始噶/茉莉花单元测试设置JSPM 404 SystemJS

Chrome 50.0.2661 (Windows 10 0.0.0) ERROR 
SystemJS was not found. Please make sure you have initialized jspm via installing a dependency with jspm, or by running 'jspm dl-loader'. 

的system.js文件位于lib文件夹中。

我的文件夹结构:

> Web 
    karma.conf.js 
    -> node_modules 
    -> lib (systemjs is located here) 
    -> js 
    config.js 
    --> ** (I will have more than one unit test folder but they will all be located at this level. All my js will be located here as well.) 
     --> Test 
      --> Unit 

我karma.conf.js

// Karma configuration 
// Generated on Fri Dec 05 2014 16:49:29 GMT-0500 (EST) 

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

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

     // frameworks to use 
     // available frameworks: https://npmjs.org/browse/keyword/karma-adapter 
     frameworks: ['jspm', 'jasmine'], 

     jspm: { 
      // Edit this to your needs 
      loadFiles: ['js/**/Test/Unit/setup.js', 'js/**/Test/Unit/**/*.js'], 
      serveFiles: ['js/**/*.js'], 
      paths: { 
       'github:*': 'lib/github/*', 
       'npm:*': 'lib/npm/*', 
       'lib/*': 'lib/*', 
       'kendo.*': 'lib/kendoui/js/kendo.*.js', 
       'kendo-ui/*': 'lib/kendoui/*', 
       'sqlsentry/*': 'lib/SqlSentry/*' 
      } 
     }, 

     // list of files/patterns to load in the browser 
     files: [], 

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


     // preprocess matching files before serving them to the browser 
     // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor 
     //preprocessors: { 
     // 'test/**/*.js': ['babel'], 
     // 'src/**/*.js': ['babel'] 
     //}, 
     //'babelPreprocessor': { 
     // options: { 
     //  sourceMap: 'inline', 
     //  presets: ['es2015-loose', 'stage-1'], 
     //  plugins: [ 
     //   'syntax-flow', 
     //   'transform-decorators-legacy', 
     //   'transform-flow-strip-types' 
     //  ] 
     // } 
     //}, 

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

     // 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_DEBUG, 

     // 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','Firefox','IE'], 

     // Continuous Integration mode 
     // if true, Karma captures browsers, runs the tests and exits 
     singleRun: false 
    }); 
}; 
+0

你解决了这个问题吗?如果是这样的话? –

+0

我没有,我去了摩卡,并用它。 – seroth

回答

1

噶执行过程中使用不同的基本路径,所以你要添加到

System.config({ 
    baseURL: (typeof __karma__ !== "undefined") ? "base" : "/" 
}); 

有请记住,每次运行jspm install时都会忽略此基本路径,因此如果您想自动化您的环境中,您可以使用自定义解决方案将baseURL添加回原来的位置。

+0

我是业力新手,请你详细说明。 – seroth

+0

你可以用JSPM,Karma和Jasmine查看我的工作项目,例如:https://github.com/ralekna/fireworks-sequencer-program-generator –