jasmine-node
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -5,3 +5,2 @@ var jasmine = require('./index'); | ||
var specFolder = null; | ||
@@ -14,2 +13,3 @@ | ||
var showColors = true; | ||
var teamcity = process.env.TEAMCITY_PROJECT_NAME || false; | ||
var extentions = "js"; | ||
@@ -36,2 +36,3 @@ var match = '.' | ||
case '--noColor': | ||
case '--nocolor': | ||
showColors = false; | ||
@@ -62,2 +63,5 @@ break; | ||
break; | ||
case '--teamcity': | ||
teamcity = true; | ||
break; | ||
default: | ||
@@ -91,3 +95,3 @@ if (arg.match(/^--/)) help(); | ||
} | ||
}, isVerbose, showColors, new RegExp(match + "spec\\.(" + extentions + ")$", 'i'), junitreport); | ||
}, isVerbose, showColors, teamcity, new RegExp(match + "spec\\.(" + extentions + ")$", 'i'), junitreport); | ||
@@ -106,6 +110,7 @@ function help(){ | ||
, ' --junitreport - export tests results as junitreport xml format' | ||
, ' --teamcity - converts all console output to teamcity custom test runner commands. (Normally auto detected.)' | ||
, '' | ||
].join("\n")); | ||
process.exit(1); | ||
process.exit(-1); | ||
} |
@@ -1,2 +0,1 @@ | ||
var fs = require('fs'); | ||
@@ -27,2 +26,3 @@ var sys = require('sys'); | ||
delete global.window; | ||
require("jasmine-reporters"); | ||
@@ -61,3 +61,3 @@ var TerminalReporter = require('./reporter').TerminalReporter; | ||
jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors, matcher, junitreport){ | ||
jasmine.executeSpecsInFolder = function(folder, done, isVerbose, showColors, teamcity, matcher, junitreport){ | ||
var fileMatcher = matcher || new RegExp(".(js)$", "i"); | ||
@@ -80,3 +80,2 @@ var colors = showColors || false; | ||
if(junitreport.report) { | ||
require("jasmine-reporters"); | ||
if(!path.existsSync(junitreport.savePath)) { | ||
@@ -89,8 +88,11 @@ sys.puts('creating junit xml report save path: ' + junitreport.savePath); | ||
jasmineEnv.addReporter(new TerminalReporter({print: sys.print, | ||
verbose: isVerbose, | ||
color: showColors, | ||
onComplete: done, | ||
stackFilter: removeJasmineFrames}) | ||
); | ||
if(teamcity){ | ||
jasmineEnv.addReporter(new jasmine.TeamcityReporter()); | ||
} else { | ||
jasmineEnv.addReporter(new TerminalReporter({print: sys.print, | ||
verbose: isVerbose, | ||
color: showColors, | ||
onComplete: done, | ||
stackFilter: removeJasmineFrames})); | ||
} | ||
@@ -97,0 +99,0 @@ jasmineEnv.execute(); |
@@ -22,2 +22,14 @@ // | ||
escapeTeamcityString = function(message) { | ||
return message.replace(/\|/g, "||") | ||
.replace(/\'/g, "|'") | ||
.replace(/\n/g, "|n") | ||
.replace(/\r/g, "|r") | ||
.replace(/\u0085/g, "|x") | ||
.replace(/\u2028/g, "|l") | ||
.replace(/\u2029/g, "|p") | ||
.replace(/\[/g, "|[") | ||
.replace(/]/g, "|]"); | ||
}; | ||
ANSIColors = { | ||
@@ -35,3 +47,2 @@ pass: function() { return '\033[32m'; }, // Green | ||
// | ||
@@ -45,2 +56,3 @@ // Reporter implementation | ||
this.color_ = config.color? ANSIColors: NoColors; | ||
this.teamcity_ = config.teamcity; | ||
this.stackFilter = config.stackFilter || function(t) { return t; } | ||
@@ -73,20 +85,41 @@ | ||
if (this.isVerbose_) | ||
if (this.isVerbose_ && !this.teamcity_) | ||
this.log_.push('Spec ' + description); | ||
if (this.teamcity_) | ||
this.log_.push("##teamcity[testSuiteStarted name='" + escapeTeamcityString(description) + "]"); | ||
outerThis = this; | ||
specResults.items_.forEach(function(spec){ | ||
if (spec.failedCount > 0 && spec.description) { | ||
if (!outerThis.isVerbose_) | ||
if (!outerThis.isVerbose_ && !outerThis.teamcity_) | ||
outerThis.log_.push(description); | ||
outerThis.log_.push(' it ' + spec.description); | ||
if (outerThis.teamcity_) { | ||
outerThis.log_.push("##teamcity[testStarted name='" + escapeTeamcityString(spec.description) + "' captureStandardOutput='true']"); | ||
} else { | ||
outerThis.log_.push(' it ' + spec.description); | ||
} | ||
spec.items_.forEach(function(result){ | ||
if (!result.passed_) | ||
outerThis.log_.push(' ' + outerThis.stackFilter(result.trace.stack) + '\n'); | ||
if (!result.passed_) { | ||
if(outerThis.teamcity_) { | ||
outerThis.log_.push("##teamcity[testFailed name='" + escapeTeamcityString(spec.description) + "' message='[FAILED]' details='" + escapeTeamcityString(outerThis.stackFilter(outerThis.stackFilter(result.trace.stack))) + "']"); | ||
} else { | ||
outerThis.log_.push(' ' + outerThis.stackFilter(result.trace.stack) + '\n'); | ||
} | ||
} | ||
}); | ||
if (outerThis.teamcity_) | ||
outerThis.log_.push("##teamcity[testFinished name='" + escapeTeamcityString(spec.description) + "']"); | ||
} else { | ||
if (outerThis.isVerbose_) | ||
if (outerThis.isVerbose_ && !outerThis.teamcity_) | ||
outerThis.log_.push(' it ' + spec.description); | ||
} | ||
}); | ||
if (this.teamcity_) | ||
this.log_.push("##teamcity[testSuiteFinished name='" + escapeTeamcityString(description) + "]"); | ||
}, | ||
@@ -93,0 +126,0 @@ |
{ | ||
"name" : "jasmine-node" | ||
, "version" : "1.0.9" | ||
, "version" : "1.0.10" | ||
, "description" : "DOM-less simple JavaScript BDD testing framework for Node" | ||
@@ -20,4 +20,3 @@ , "homepage" : [ "http://pivotal.github.com/jasmine" | ||
, "dependencies" : { "coffee-script" : ">=1.0.1", "jasmine-reporters" : "0.1.0"} | ||
, "bin" : "bin/jasmine-node" | ||
, "main" : "lib/jasmine-node" | ||
, "main" : "bin/jasmine-node" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
86205
2609
0
5