From 87f0ac0d2fd0889c5b95640143682c697d05dd71 Mon Sep 17 00:00:00 2001 From: Liam Newman Date: Wed, 30 Jan 2013 13:21:00 -0800 Subject: [PATCH] test: use reporter specified in config for e2e tests E2E test framework was overriding the reporters on the commandline. This meant that tests e2e tests for reporter were not even using the reporters they were supposed testing. The test now use the specified reporters, even if they don't verify their outputs. --- lib/reporter.js | 2 ++ tasks/test.js | 2 +- test/e2e/angular-scenario/testacular.conf.js | 2 ++ test/e2e/basic/testacular.conf.js | 2 ++ test/e2e/coffee/testacular.conf.js | 2 ++ test/e2e/junit/plus.js | 4 ++++ test/e2e/junit/test.js | 11 ++++++++++ test/e2e/junit/testacular.conf.js | 22 ++++++++++++++++++++ test/e2e/mocha/testacular.conf.js | 2 ++ test/e2e/qunit/testacular.conf.js | 2 ++ test/e2e/requirejs/testacular.conf.js | 2 +- test/e2e/syntax-error/testacular.conf | 1 + 12 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 test/e2e/junit/plus.js create mode 100644 test/e2e/junit/test.js create mode 100644 test/e2e/junit/testacular.conf.js diff --git a/lib/reporter.js b/lib/reporter.js index 1d4ce1d1f..e45f6e4ad 100644 --- a/lib/reporter.js +++ b/lib/reporter.js @@ -32,6 +32,8 @@ var createReporters = function(names, config, emitter) { var multiReporter = new MultiReporter(); names.forEach(function(name) { + log.debug('Using reporter "%s".', name); + if (name === 'junit') { return multiReporter.reporters.push(new exports.JUnit(errorFormatter, config.junitReporter.outputFile, config.junitReporter.suite, emitter)); diff --git a/tasks/test.js b/tasks/test.js index 3638e61d4..f50a24d4d 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -45,7 +45,7 @@ module.exports = function(grunt) { var tests = grunt.file.expand(this.data); var processToKill; var args = [ - 'start', null, '--single-run', '--no-auto-watch', '--reporters=dots', '--browsers=' + BROWSERS + 'start', null, '--single-run', '--no-auto-watch', '--browsers=' + BROWSERS ]; var next = function(err, result, code) { diff --git a/test/e2e/angular-scenario/testacular.conf.js b/test/e2e/angular-scenario/testacular.conf.js index 54394abe4..dbf0648a1 100644 --- a/test/e2e/angular-scenario/testacular.conf.js +++ b/test/e2e/angular-scenario/testacular.conf.js @@ -11,3 +11,5 @@ autoWatch = true; proxies = { '/': 'http://localhost:8000/test/e2e/angular-scenario/' }; + +reporters = ['dots']; \ No newline at end of file diff --git a/test/e2e/basic/testacular.conf.js b/test/e2e/basic/testacular.conf.js index 7a7b4541f..af4a0e743 100644 --- a/test/e2e/basic/testacular.conf.js +++ b/test/e2e/basic/testacular.conf.js @@ -11,3 +11,5 @@ exclude = [ autoWatch = true; browsers = ['Chrome'] + +reporters = ['dots']; \ No newline at end of file diff --git a/test/e2e/coffee/testacular.conf.js b/test/e2e/coffee/testacular.conf.js index dc0f85367..54e82a968 100644 --- a/test/e2e/coffee/testacular.conf.js +++ b/test/e2e/coffee/testacular.conf.js @@ -13,3 +13,5 @@ browsers = ['Chrome']; preprocessors = { '**/*.coffee': 'coffee' }; + +reporters = ['dots']; \ No newline at end of file diff --git a/test/e2e/junit/plus.js b/test/e2e/junit/plus.js new file mode 100644 index 000000000..c3aa2d83c --- /dev/null +++ b/test/e2e/junit/plus.js @@ -0,0 +1,4 @@ +// Some code under test +function plus(a, b) { + return a + b; +} diff --git a/test/e2e/junit/test.js b/test/e2e/junit/test.js new file mode 100644 index 000000000..9e4d408bf --- /dev/null +++ b/test/e2e/junit/test.js @@ -0,0 +1,11 @@ +describe('plus', function() { + it('should pass', function() { + expect(true).toBe(true); + }); + + it('should work', function() { + console.log("First parameter: 1"); + console.log("Second parameter: 2"); + expect(plus(1, 2)).toBe(3); + }); +}); diff --git a/test/e2e/junit/testacular.conf.js b/test/e2e/junit/testacular.conf.js new file mode 100644 index 000000000..fedb2d0fd --- /dev/null +++ b/test/e2e/junit/testacular.conf.js @@ -0,0 +1,22 @@ +files = [ + JASMINE, + JASMINE_ADAPTER, + '*.js' +]; + +exclude = [ + 'testacular.conf.js' +]; + +autoWatch = true; + +browsers = ['Chrome'] + +reporters = ['dots', 'junit']; + +logLevel = LOG_DEBUG; + +junitReporter = { + outputFile: 'test-results.xml' +}; + diff --git a/test/e2e/mocha/testacular.conf.js b/test/e2e/mocha/testacular.conf.js index 6ca7764bd..312d012d3 100644 --- a/test/e2e/mocha/testacular.conf.js +++ b/test/e2e/mocha/testacular.conf.js @@ -11,3 +11,5 @@ exclude = [ autoWatch = true; browsers = ['Chrome']; singleRun = false; + +reporters = ['dots']; \ No newline at end of file diff --git a/test/e2e/qunit/testacular.conf.js b/test/e2e/qunit/testacular.conf.js index e7908cb17..a24eed121 100644 --- a/test/e2e/qunit/testacular.conf.js +++ b/test/e2e/qunit/testacular.conf.js @@ -11,3 +11,5 @@ exclude = [ autoWatch = true; browsers = ['Chrome'] + +reporters = ['dots']; \ No newline at end of file diff --git a/test/e2e/requirejs/testacular.conf.js b/test/e2e/requirejs/testacular.conf.js index 0a8047c87..37bb0da1c 100644 --- a/test/e2e/requirejs/testacular.conf.js +++ b/test/e2e/requirejs/testacular.conf.js @@ -28,7 +28,7 @@ exclude = []; // test results reporter to use // possible values: dots || progress -reporter = 'progress'; +reporter = 'dots'; // web server port diff --git a/test/e2e/syntax-error/testacular.conf b/test/e2e/syntax-error/testacular.conf index c8d419c59..cb3084314 100644 --- a/test/e2e/syntax-error/testacular.conf +++ b/test/e2e/syntax-error/testacular.conf @@ -9,3 +9,4 @@ autoWatch = true; autoWatchInterval = 1; logLevel = LOG_INFO; logColors = true; +reporters = ['dots']; \ No newline at end of file