我想让Karma / Babel / Jasmine / Aurelia一起工作但是我在运行业力开始时遇到这个错误
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 :(得分:1)
Karma在执行期间使用不同的基本路径,因此您必须添加到
System.config({
baseURL: (typeof __karma__ !== "undefined") ? "base" : "/"
});
请记住,每次运行jspm install
时都会覆盖此基本路径。因此,如果您想要自动化您的环境,则可以使用自定义解决方案将baseURL
添加回原来的位置。