【发布时间】:2016-12-23 01:14:48
【问题描述】:
这很奇怪。我正在尝试非常简单的示例。 Karma 会阅读我的测试。但拒绝说他们在输出中是通过还是失败。
这是我的配置文件:
// Karma configuration
// Generated on Mon Dec 19 2016 15:50:01 GMT-0500 (Eastern Standard Time)
module.exports = function(config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '/src/tt',
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],
//plugins
plugins: [
'karma-jasmine',
'karma-chrome-launcher',
'karma-phantomjs-launcher',
'karma-istanbul',
'karma-coverage'
],
// list of files / patterns to load in the browser
files: [
//'server/src/main/resources/webapp/static/app/**/*.js'
//'server/src/main/resources/webapp/static/app/test-view/test-view-controller.spec.js',
'test.spec.js'
],
// list of files to exclude
exclude: [
//'bower_components',
//'node_modules',
//'server/src/main/resources/webapp/static/bower/**/*'
],
// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
//'/**/!(*spec).js': ['coverage'],
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: [],
//reporters: [ 'coverage'],
// 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'],
browsers: ['PhantomJS'],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,
// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
})
}
这是我的测试文件:
'use strict'
describe('test', function() {
it('has to equal 4',
function() {
expect(3).toEqual(4);
});
});
我错过了一些基本的东西吗?昨天下午我花了越来越多的时间来尝试运行一项测试,但我不确定还有什么可做的。
这是调试输出,所以我知道我正在加载我的测试文件但没有结果。
21 12 2016 09:44:19.051:DEBUG [web-server]: serving (cached): c:/src/TT/node_mod
ules/karma-jasmine/lib/adapter.js
21 12 2016 09:44:19.054:DEBUG [middleware:source-files]: Requesting /base/test.s
pec.js?25b2b285aaae5dc1b28e003730ae0711891ed68b /
21 12 2016 09:44:19.055:DEBUG [middleware:source-files]: Fetching c:/src/tt/test
.spec.js
21 12 2016 09:44:19.056:DEBUG [web-server]: serving (cached): c:/src/tt/test.spe
c.js
21 12 2016 09:44:19.075:DEBUG [karma]: Run complete, exiting.
21 12 2016 09:44:19.078:DEBUG [launcher]: Disconnecting all browsers
21 12 2016 09:44:19.090:DEBUG [launcher]: Process PhantomJS exited with code 0
21 12 2016 09:44:19.091:DEBUG [temp-dir]: Cleaning temp dir c:\AppData\Local\Tem
p\karma-63269551
21 12 2016 09:44:19.097:DEBUG [launcher]: Finished all browsers
谁想让我感到愚蠢并指出破坏我一天的逗号或引号?
【问题讨论】:
-
谢谢...我尝试添加它,但没有任何乐趣。我还添加了一个 console.log('test*********');符合我的规范,这也没有出现在输出中。嗯……还有其他想法吗?
标签: jasmine karma-jasmine