Reputation: 131
This is pretty weird. I'm trying incredibly simple examples. Karma will read my tests. But refuses to say if they passed or failed in the output.
Here's my config file:
// 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
})
}
And here is my test file:
'use strict'
describe('test', function() {
it('has to equal 4',
function() {
expect(3).toEqual(4);
});
});
Am I missing something basic? I spent all yesterday afternoon stripping out more and more just trying to get one test to run and I'm not sure what else there is to do.
Here's the debug output so I know I'm loading my test file but no results.
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
Who wants to make me feel dumb and point out the comma or quote that's ruining my day?
Upvotes: 2
Views: 2360
Reputation: 131
Okay, so I found my own answer finally here (for credit): Need proper reporter for karma jasmine
The newer jasmine/karma requires you ass the karma-spec-reporter if you want test results to print to the console output. Considering all I've ever used with karma is phantomJS it was pretty difficult to tell that my tests were actually running just fine. Aggravating but hopefully this helps someone else who's stuck too.
Upvotes: 1