1
角度jを使用したユニットテストにkarmaとjasmineを使用していますが、次のエラーが発生します。AngularJSが動作していないカルマ
Chrome 54.0.2840 (Mac OS X 10.11.6) LOG: 'WARNING: Tried to load angular more than once.'
Chrome 54.0.2840 (Mac OS X 10.11.6) ERROR
Uncaught TypeError: window.angular.$$csp is not a function
at node_modules/angular/angular.js:31768
私はkarma.conf.jsファイルと以下の角度モジュールを添付しました。
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: ['jasmine', 'ng-scenario'],
// list of files/patterns to load in the browser
files: [
'./node_modules/angular/angular.js',
'./node_modules/angular-ui-router/release/angular-ui-router.js',
'./node_modules/angular-mocks/angular-mocks.js',
'./app/**/*.js',
'./test/logger/loggerControllerTest.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
preprocessors: {
},
// 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'],
// 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
})
}
後の角度モジュール作成スニペットです。
var app = angular.module("gradchatApp", [
ngRoute,
ngAnimate,
ngAria,
ngMessages,
ngResource,
ngSanitize,
ngTouch,
ngCookies,
angularMoment,
angularMaterial,
'ngDialog',
'infinite-scroll',
require('angular-bootstrap-npm')
]);
上記のエラーを解決するのを手伝ってください。