karma-tap-reporter
Advanced tools
Comparing version 0.0.2 to 0.0.3
39
index.js
@@ -1,5 +0,25 @@ | ||
var TAPReporter = function(baseReporterDecorator) { | ||
var TAPReporter = function(baseReporterDecorator, config, logger) { | ||
var tapReporterConfig = config.tapReporter || {}, | ||
log = logger.create('karma-tap-reporter'), | ||
_this = this, | ||
output = '', | ||
path = require('path'), | ||
fs = require('fs'), | ||
numbers, outputFile; | ||
/** | ||
* save all data that is coming in to the `data` variable for later use and | ||
* proxy input to `this.write` | ||
*/ | ||
function write(data) { | ||
output = output + data; | ||
_this.write(data); | ||
} | ||
if (tapReporterConfig.outputFile) { | ||
outputFile = path.resolve(config.basePath, tapReporterConfig.outputFile) | ||
} | ||
baseReporterDecorator(this); | ||
var numbers; | ||
this.onRunStart = function() { | ||
@@ -14,11 +34,11 @@ numbers = new Object(); | ||
this.specSuccess = function(browser, result) { | ||
this.write("ok " + ++numbers[browser.id] + " " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
write("ok " + ++numbers[browser.id] + " " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
}; | ||
this.specFailure = function(browser, result) { | ||
this.write("not ok " + ++numbers[browser.id] + " " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
write("not ok " + ++numbers[browser.id] + " " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
}; | ||
this.specSkipped = function(browser, result) { | ||
this.write("ok " + ++numbers[browser.id] + " " + "# skip " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
write("ok " + ++numbers[browser.id] + " " + "# skip " + result.suite.join(' ').replace(/\./g, '_') + " " + result.description + "\n"); | ||
}; | ||
@@ -31,7 +51,12 @@ | ||
}); | ||
this.write("1.." + total + "\n"); | ||
write("1.." + total + "\n"); | ||
if (outputFile) { | ||
log.info('writing report to file: ' + outputFile); | ||
fs.writeFileSync(outputFile, output); | ||
} | ||
}; | ||
}; | ||
TAPReporter.$inject = ['baseReporterDecorator', 'logger']; | ||
TAPReporter.$inject = ['baseReporterDecorator', 'config', 'logger']; | ||
@@ -38,0 +63,0 @@ module.exports = { |
{ | ||
"name": "karma-tap-reporter", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "A Karma plugin. Report results in TAP protocol.", | ||
@@ -17,3 +17,4 @@ "main": "index.js", | ||
"contributors": [ | ||
"lgersman <lars.gersmann@gmail.com> (http://www.orangevolt.com)" | ||
"lgersman <lars.gersmann@gmail.com> (http://www.orangevolt.com)", | ||
"Dmitrii Abramov" | ||
], | ||
@@ -20,0 +21,0 @@ "peerDependencies": { |
@@ -12,3 +12,3 @@ # karma-tap-reporter | ||
"karma": "~0.10", | ||
"karma-tap-reporter": "~0.0.1" | ||
"karma-tap-reporter": "~0.0.2" | ||
} | ||
@@ -27,2 +27,11 @@ } | ||
``` | ||
Optionally you can save report to a file | ||
```js | ||
reporters: ['tap'], | ||
tapReporter: { | ||
outputFile: './unit.tap' | ||
} | ||
``` | ||
---- | ||
@@ -29,0 +38,0 @@ |
Sorry, the diff of this file is not supported yet
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
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
Uses eval
Supply chain riskPackage uses eval() which is a dangerous function. This prevents the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
40
0
6444
6
51