ユニットテストをインスタンス化に失敗したカルマはカルマapp.jsで定義されている「ヒューズ」と呼ばれる私のアプリのメインモジュールを見つけることができない...カルマとジャスミンをメインアプリモジュール
'fuse':Error: [$injector:nomod] Module 'fuse' is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument. http://errors.angularjs.org/1.5.8/$injector/n
私はkarma.conf.jsの依存関係を回避しようとしましたが、私は可能な解決策としてbrowserifyまたはrequirejsを指定しようとしました。どのように進めるか正確にはわからず、正しい方向にポインタを使用することができます。ここで
そして、ここでは私のkarma.confファイルです:
// Karma configuration
// Generated on Fri Jul 22 2016 15:18:36 GMT-0500 (CDT)
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
// list of files/patterns to load in the browser
files: [
//angular mocks
'bower_components/angular/angular.js',
'bower_components/angular-resource/angular-resource.js',
'bower_components/angular-mocs/angular-mocks.js',
'bower_components/angular-resource/angular-resource.js',
//test file locations
'public/app/app.js',
'public/**/*.spec.js'
],
// list of files to exclude
exclude: [
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
browserify: {
watch: true,
debug: true
},
preprocessors: {
'public/*': ['browserify']
},
// 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_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', 'Firefox'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity,
plugins : [
'karma-requirejs',
'karma-jasmine',
'karma-chrome-launcher',
'karma-firefox-launcher',
'karma-browserify'
],
frameworks: ['jasmine', 'browserify']
})
}
spec.jsとは何ですか –
私のテストファイルはすべてクライアントコードの隣にあり、specで終わります –