Zurb foundation Zurb基金会应用程序与Karma的集成+;茉莉花 我是一个基础和角度的新手,但我已经成功地使用基金会CLI建立了一个基金会应用程序项目;然而,我无法让测试跑步者工作。我将Karma与Jasmine测试框架一起使用,但尚未成功加载angular模块。任何帮助都将不胜感激!该应用程序运行良好,但使用karma加载资源进行测试不起作用
我收到的错误是:Zurb foundation Zurb基金会应用程序与Karma的集成+;茉莉花 我是一个基础和角度的新手,但我已经成功地使用基金会CLI建立了一个基金会应用程序项目;然而,我无法让测试跑步者工作。我将Karma与Jasmine测试框架一起使用,但尚未成功加载angular模块。任何帮助都将不胜感激!该应用程序运行良好,但使用karma加载资源进行测试不起作用,zurb-foundation,karma-jasmine,Zurb Foundation,Karma Jasmine,我收到的错误是: ReferenceError. module is not defined... 我猜它无法加载“应用程序”,这是我的angular应用程序。感谢您的帮助 目录结构: app.js: karma.conf: 我的演示规格: 我有相同的问题,通过在App.js之前在构建目录中引用基础.js和例程.js文件来解决这个问题。同样,angul.js应该作为基础的一部分被加载。JS被加载,这样你就不需要直接加载盎格鲁.js。 也就是说,一旦它能够使用模块,我的模块“应用程序”就不会被加
ReferenceError. module is not defined...
我猜它无法加载“应用程序”,这是我的angular应用程序。感谢您的帮助
目录结构:
app.js:
karma.conf:
我的演示规格:
我有相同的问题,通过在App.js之前在构建目录中引用基础.js和例程.js文件来解决这个问题。同样,angul.js应该作为基础的一部分被加载。JS被加载,这样你就不需要直接加载盎格鲁.js。 也就是说,一旦它能够使用模块,我的模块“应用程序”就不会被加载。从这篇文章开始你就解决了吗
/root
/bower_components
/build
/assets
/components
/templates
index.html
/client
/assets
/templates
index.html
/node_modules
... local packages ...
/test
bower.json
gulpfile.js
karma.conf.js
package.json
test-main.js
(function () {
'use strict';
angular.module('application', [
'ui.router',
'ngAnimate',
//foundation
'foundation',
'foundation.dynamicRouting',
'foundation.dynamicRouting.animations'
])
.config(config)
.run(run)
config.$inject = ['$urlRouterProvider', '$locationProvider'];
function config($urlProvider, $locationProvider) {
$urlProvider.otherwise('/');
$locationProvider.html5Mode({
enabled: false,
requireBase: false
});
$locationProvider.hashPrefix('!');
}
function run() {
FastClick.attach(document.body);
}
})();
// Karma configuration
// Generated on Sun Mar 08 2015 18:16:11 GMT-0500 (Central Daylight Time)
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'],
// list of files / patterns to load in the browser
files: [
'bower_components/angular/angular.js',
'bower_components/angular-ui-router/release/angular-ui-router.min.js',
'bower_components/angular-animate/angular-animate.min.js',
'bower_components/angular-mocks/angular-mocks.js',
'build/assets/js/app.js',
'client/assets/services/*.js',
'test/unit/*.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
});
};
'use strict';
describe('Sample Test',function(){
it('should know that 2+2=4',function(){
var simpleMath = 2+2;
expect(simpleMath).toBe(4)
})
});
describe("EventService", function(){
beforeEach(angular.mock.module("application"));
var service;
beforeEach(inject(function(eventservice){
service = eventservice;
}));
describe("Events", function(){
it("should return an array of items", function(){
expect(service.events()).toBeDefined();
});
});
});