From edd0eb5dc6c1c35fed8032e87c4ea512860ab9af Mon Sep 17 00:00:00 2001 From: "c.bate" Date: Wed, 16 Jul 2014 19:43:13 -0300 Subject: [PATCH 1/4] Add an option for a Teamcity reporter. --- lib/jasmine-node/jasmine-loader.js | 11 +++++++++-- lib/jasmine-node/runner.js | 7 ++++--- package.json | 4 ++-- src/jasmine-loader.coffee | 7 ++++++- src/runner.coffee | 5 ++++- 5 files changed, 25 insertions(+), 9 deletions(-) diff --git a/lib/jasmine-node/jasmine-loader.js b/lib/jasmine-node/jasmine-loader.js index 6f86a56..62b9d09 100644 --- a/lib/jasmine-node/jasmine-loader.js +++ b/lib/jasmine-node/jasmine-loader.js @@ -124,7 +124,7 @@ }; executeSpecsInFolder = function(options) { - var defaults, error, jasmine, jasmineEnv, junit, nunit, spec, specsList, _i, _len; + var defaults, error, jasmine, jasmineEnv, junit, nunit, spec, specsList, teamcity, _i, _len; jasmineEnv = loadJasmine(); defaults = { regExpSpec: new RegExp(".(js)$", "i"), @@ -147,7 +147,14 @@ nunit = new reporters.NUnitXmlReporter(options.reporterConfigOpts); jasmine.addReporter(nunit); } - if (!(options.junit || options.nunit)) { + if (options.teamcity) { + if (options.reporterConfigOpts == null) { + options.reporterConfigOpts = {}; + } + teamcity = new reporters.TeamCityReporter(options.reporterConfigOpts); + jasmine.addReporter(teamcity); + } + if (!(options.junit || options.nunit || options.teamcity)) { jasmine.addReporter(new jasmineEnv.TerminalReporter(options)); } if (options.growl) { diff --git a/lib/jasmine-node/runner.js b/lib/jasmine-node/runner.js index dddb2e6..7ffd9b1 100644 --- a/lib/jasmine-node/runner.js +++ b/lib/jasmine-node/runner.js @@ -19,7 +19,7 @@ autoTest = require('./auto-test'); minimistOpts = { - boolean: ["autoTest", "captureExceptions", "coffee", "debug", "forceColor", "growl", "h", "help", "junit", "nunit", "matchAll", "noColor", "noStackTrace", "verbose", "version"], + boolean: ["autoTest", "captureExceptions", "coffee", "debug", "forceColor", "growl", "h", "help", "junit", "nunit", "matchAll", "noColor", "noStackTrace", "teamcity", "verbose", "version"], string: ["reporterConfig", "m", "match", "watchFolders"], alias: { match: "m", @@ -41,6 +41,7 @@ nunit: false, onComplete: function() {}, reporterConfig: '', + teamcity: false, specFolders: [], verbose: false, watchFolders: [] @@ -50,12 +51,12 @@ exitCode = 0; printVersion = function() { - console.log("2.0.0-beta4"); + console.log("2.0.1-colin1"); process.exit(0); }; help = function() { - process.stdout.write("USAGE: jasmine-node [--color|--noColor] [--verbose] [--coffee] directory\n\nOptions:\n --autoTest - rerun automatically the specs when a file changes\n --captureExceptions - listen to global exceptions, report them and exit (interferes with Domains)\n --coffee - load coffee-script which allows execution .coffee files\n --growl - display test run summary in a growl notification (in addition to other outputs)\n --help, -h - display this help and exit\n --junit - use the junit reporter\n --match, -m REGEXP - load only specs containing \"REGEXPspec\"\n --matchAll - relax requirement of \"spec\" in spec file names\n --noColor - do not use color coding for output\n --noStackTrace - suppress the stack trace generated from a test failure\n --nunit - use the nunit reporter\n --reporterConfig - configuration json file to use with jasmine-reporters [nunit, junit]\n --verbose - print extra information per each test run\n --version - show the current version\n --watch PATH - when used with --autoTest, watches the given path(s) and runs all tests if a change is detected"); + process.stdout.write("USAGE: jasmine-node [--color|--noColor] [--verbose] [--coffee] directory\n\nOptions:\n --autoTest - rerun automatically the specs when a file changes\n --captureExceptions - listen to global exceptions, report them and exit (interferes with Domains)\n --coffee - load coffee-script which allows execution .coffee files\n --growl - display test run summary in a growl notification (in addition to other outputs)\n --help, -h - display this help and exit\n --junit - use the junit reporter\n --match, -m REGEXP - load only specs containing \"REGEXPspec\"\n --matchAll - relax requirement of \"spec\" in spec file names\n --noColor - do not use color coding for output\n --noStackTrace - suppress the stack trace generated from a test failure\n --nunit - use the nunit reporter\n --reporterConfig - configuration json file to use with jasmine-reporters [nunit, junit]\n --teamcity - use the teamcity reporter\n --verbose - print extra information per each test run\n --version - show the current version\n --watch PATH - when used with --autoTest, watches the given path(s) and runs all tests if a change is detected"); process.exit(-1); }; diff --git a/package.json b/package.json index 65b0bb0..321b48d 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jasmine-node", - "version": "2.0.0-beta4", + "version": "2.0.1-colin1", "description": "DOM-less simple JavaScript BDD testing framework for Node", "contributors": [ "Chris Moultrie " @@ -32,7 +32,7 @@ "jasmine-growl-reporter": "~0.2.0", "xml2js": "~0.4.1", "grunt-exec": "~0.4.5", - "jasmine-reporters": "git://github.com/larrymyers/jasmine-reporters.git#2c7242dc11c15c2f156169bc704798568b8cb50d" + "jasmine-reporters": "~2.0.1" }, "devDependencies": { "grunt-contrib-coffee": "~0.10.1", diff --git a/src/jasmine-loader.coffee b/src/jasmine-loader.coffee index 9593c24..574a108 100644 --- a/src/jasmine-loader.coffee +++ b/src/jasmine-loader.coffee @@ -127,8 +127,13 @@ executeSpecsInFolder = (options) -> nunit = new reporters.NUnitXmlReporter options.reporterConfigOpts jasmine.addReporter nunit + if options.teamcity + options.reporterConfigOpts ?= {} + teamcity = new reporters.TeamCityReporter options.reporterConfigOpts + jasmine.addReporter teamcity + # If not using junit and not using nunit, Terminal Reporter! - unless options.junit or options.nunit + unless options.junit or options.nunit or options.teamcity jasmine.addReporter new jasmineEnv.TerminalReporter options if options.growl diff --git a/src/runner.coffee b/src/runner.coffee index 8697e0b..782fa2a 100644 --- a/src/runner.coffee +++ b/src/runner.coffee @@ -24,6 +24,7 @@ minimistOpts = "matchAll" "noColor" "noStackTrace" + "teamcity" "verbose" "version" ] @@ -54,6 +55,7 @@ minimistOpts = nunit : false onComplete : -> return reporterConfig : '' + teamcity : false specFolders : [] verbose : false watchFolders : [] @@ -61,7 +63,7 @@ minimistOpts = exitCode = 0 printVersion = -> - console.log "2.0.0-beta4" + console.log "2.0.1-colin1" process.exit 0 return @@ -83,6 +85,7 @@ Options: --noStackTrace - suppress the stack trace generated from a test failure --nunit - use the nunit reporter --reporterConfig - configuration json file to use with jasmine-reporters [nunit, junit] + --teamcity - use the teamcity reporter --verbose - print extra information per each test run --version - show the current version --watch PATH - when used with --autoTest, watches the given path(s) and runs all tests if a change is detected From 0019d0c7e6efde67b7a32953b4a6ea81bfc9eba7 Mon Sep 17 00:00:00 2001 From: "c.bate" Date: Wed, 16 Jul 2014 19:53:09 -0300 Subject: [PATCH 2/4] Revert version number for better merging. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 321b48d..61d4f5f 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jasmine-node", - "version": "2.0.1-colin1", + "version": "2.0.0-beta4", "description": "DOM-less simple JavaScript BDD testing framework for Node", "contributors": [ "Chris Moultrie " From 9943a1cea9cd5972462cae9ea702ce74a3612060 Mon Sep 17 00:00:00 2001 From: "c.bate" Date: Wed, 16 Jul 2014 19:54:41 -0300 Subject: [PATCH 3/4] Revert version number for better merging (part 2). --- lib/jasmine-node/runner.js | 2 +- src/runner.coffee | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/jasmine-node/runner.js b/lib/jasmine-node/runner.js index 7ffd9b1..b936ec4 100644 --- a/lib/jasmine-node/runner.js +++ b/lib/jasmine-node/runner.js @@ -51,7 +51,7 @@ exitCode = 0; printVersion = function() { - console.log("2.0.1-colin1"); + console.log("2.0.0-beta4"); process.exit(0); }; diff --git a/src/runner.coffee b/src/runner.coffee index 782fa2a..bab9944 100644 --- a/src/runner.coffee +++ b/src/runner.coffee @@ -63,7 +63,7 @@ minimistOpts = exitCode = 0 printVersion = -> - console.log "2.0.1-colin1" + console.log "2.0.0-beta4" process.exit 0 return From cc4c0da686fd0594ef9bd3ef3626ed8bf8079fd2 Mon Sep 17 00:00:00 2001 From: "c.bate" Date: Wed, 23 Jul 2014 16:38:22 -0300 Subject: [PATCH 4/4] Update version of jasmine-reporters which had a TC issue. --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 61d4f5f..cea4e4c 100755 --- a/package.json +++ b/package.json @@ -32,7 +32,7 @@ "jasmine-growl-reporter": "~0.2.0", "xml2js": "~0.4.1", "grunt-exec": "~0.4.5", - "jasmine-reporters": "~2.0.1" + "jasmine-reporters": "~2.0.2" }, "devDependencies": { "grunt-contrib-coffee": "~0.10.1",