[英]PhantomJS catching error in Jasmine
我有一個針對大型應用程序構建的大型測試套件。
該套件包括多達二十個不同的JS規范文件,這些文件針對該應用程序進行了數百次測試。 到目前為止,Jasmine(通過Grunt手表運行)無法在不拋出“警告:未定義,請使用--force繼續”消息的情況下進行所有測試。
如果我運行SpecRunner.html文件,則所有測試均通過,即使PhantomJS說可以在此處找到更多信息,也沒有其他信息。
對一個人可以編寫的測試數量有某種限制嗎?
我正在使用grunt v。 ^ 0.4.5和grunt-contrib-jasmin v。〜0.6.3 。
module.exports = function(grunt) {
// Project configuration. Can be any arbitrary data.
// Things you might want to <% %> include in tasks.
// These data can be accessed by grunt.config.<property>
// Taksa are also configured here taking the format:
// <taskname>: { <target1>: {}, <target2>: {} }
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
js: {
lib: [
'PriceAnalytics.Web/Scripts/lib/jquery/*.min.js', // jquery needs to be loaded before bootstrap
'PriceAnalytics.Web/Scripts/lib/bootstrap/bootstrap.min.js',
'PriceAnalytics.Web/Scripts/lib/knockout/knockout*.js',
'PriceAnalytics.Web/Scripts/lib/underscore/underscore.min.js',
'PriceAnalytics.Web/Scripts/lib/underscore/underscore.mixin.deepExtend.js',
'PriceAnalytics.Web/Scripts/lib/globalize/globalize.js',
'PriceAnalytics.Web/Scripts/lib/highcharts/highcharts.js'
],
src: 'PriceAnalytics.Web/Scripts/src/**/*.js',
spec: 'PriceAnalytics.Web.Test/spec/**/*.js'
},
jasmine: {
src: '<%= js.src %>',
options: {
specs: '<%= js.spec %>',
vendor: '<%= js.lib %>',
//display: 'short',
summary: true
//keepRunner: true could probably leverage this option so that we don't have to manually maintain teh specrunner script tags
}
},
watch: {
gruntfile: {
files: '<%= jshint.gruntfile.src %>',
tasks: ['jshint:gruntfile']
},
src_spec: {
files: '<%= jshint.src_spec.src %>',
tasks: ['jshint:src_spec', 'jasmine']
}
}
});
// Load the plugins
grunt.loadNpmTasks('grunt-contrib-jasmine');
grunt.loadNpmTasks('grunt-contrib-watch');
// Default task(s)
grunt.registerTask('default', ['jasmine']);
};
事實證明,我們的應用程序代碼中存在一個錯誤,該錯誤引發了來自try / catch的錯誤,從而導致測試失敗/無法運行。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.