diff --git a/lib/constants.js b/lib/constants.js index 15da4dc0d..d815ac379 100644 --- a/lib/constants.js +++ b/lib/constants.js @@ -20,9 +20,9 @@ exports.LOG_PRIORITIES = [ exports.LOG_DISABLE, exports.LOG_ERROR, exports.LOG_WARN, + exports.LOG_LOG, exports.LOG_INFO, - exports.LOG_DEBUG, - exports.LOG_LOG + exports.LOG_DEBUG ] // Default patterns for the pattern layout. diff --git a/test/e2e/browser_console.feature b/test/e2e/browser_console.feature index 53a83ac8e..36578b4e2 100644 --- a/test/e2e/browser_console.feature +++ b/test/e2e/browser_console.feature @@ -11,10 +11,7 @@ Feature: Browser Console Configuration plugins = [ 'karma-jasmine', 'karma-phantomjs-launcher' - ], - browserConsoleLogOptions = { - level: 'log' - }; + ]; """ When I start Karma Then it passes with like: diff --git a/test/unit/reporters/base.spec.js b/test/unit/reporters/base.spec.js index 291e5f4f0..ed75037ad 100644 --- a/test/unit/reporters/base.spec.js +++ b/test/unit/reporters/base.spec.js @@ -103,6 +103,19 @@ describe('reporter', function () { }, adapter) var writeSpy = sinon.spy(reporter, 'writeCommonMsg') + reporter._browsers = ['Chrome'] + reporter.onBrowserLog('Chrome', 'Message', 'LOG') + + return writeSpy.should.have.not.been.called + }) + + it('should not log if lower priority than browserConsoleLogOptions "log"', function () { + var reporter = new m.BaseReporter(null, null, true, { + level: 'log', + terminal: true + }, adapter) + var writeSpy = sinon.spy(reporter, 'writeCommonMsg') + reporter._browsers = ['Chrome'] reporter.onBrowserLog('Chrome', 'Message', 'INFO') @@ -122,9 +135,35 @@ describe('reporter', function () { return writeSpy.should.have.not.been.called }) - it('should not log if lower priority than browserConsoleLogOptions "debug"', function () { + it('should log if higher priority than browserConsoleLogOptions "warn"', function () { var reporter = new m.BaseReporter(null, null, true, { - level: 'debug', + level: 'warn', + terminal: true + }, adapter) + var writeSpy = sinon.spy(reporter, 'writeCommonMsg') + + reporter._browsers = ['Chrome'] + reporter.onBrowserLog('Chrome', 'Message', 'ERROR') + + return writeSpy.should.have.been.called + }) + + it('should log if higher priority than browserConsoleLogOptions "log"', function () { + var reporter = new m.BaseReporter(null, null, true, { + level: 'log', + terminal: true + }, adapter) + var writeSpy = sinon.spy(reporter, 'writeCommonMsg') + + reporter._browsers = ['Chrome'] + reporter.onBrowserLog('Chrome', 'Message', 'WARN') + + return writeSpy.should.have.been.called + }) + + it('should log if higher priority than browserConsoleLogOptions "info"', function () { + var reporter = new m.BaseReporter(null, null, true, { + level: 'info', terminal: true }, adapter) var writeSpy = sinon.spy(reporter, 'writeCommonMsg') @@ -132,7 +171,20 @@ describe('reporter', function () { reporter._browsers = ['Chrome'] reporter.onBrowserLog('Chrome', 'Message', 'LOG') - return writeSpy.should.have.not.been.called + return writeSpy.should.have.been.called + }) + + it('should log if higher priority than browserConsoleLogOptions "debug"', function () { + var reporter = new m.BaseReporter(null, null, true, { + level: 'debug', + terminal: true + }, adapter) + var writeSpy = sinon.spy(reporter, 'writeCommonMsg') + + reporter._browsers = ['Chrome'] + reporter.onBrowserLog('Chrome', 'Message', 'INFO') + + return writeSpy.should.have.been.called }) return it('should format log messages correctly for multi browsers', function () {