Last active
April 20, 2018 10:56
-
-
Save arialdomartini/dd7d3f1e2428dfbf5262b571ed66955b to your computer and use it in GitHub Desktop.
gulp xunit cover
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
gulp.task('test', "Run all the tests", ["build", "tools:download:xunit-runner"], function() { | |
console.log(config.tools.xunit.path) | |
var options = { | |
executable: config.tools.xunit.path, | |
options: { | |
nologo: true, | |
xml: config.testResult | |
} | |
} | |
var assemblies = [`../**/bin/${config.buildConfiguration}/*.Test.dll`] | |
return gulp.src(assemblies, {read: true}).pipe(xunit(options)); | |
}) | |
// Possibile approccio | |
gulp.task('cover', "Run test code coverage and outputs an html report", [], () => { | |
var through = require('through2'); | |
var assemblies = [`../**/bin/${config.buildConfiguration}/*.Test.dll`] | |
var fileList = [] | |
gulp.src(assemblies) | |
.pipe(through.obj(function (file, enc, cb) { | |
fileList.push(file.path); | |
cb(null); | |
})) | |
.pipe(gulp.dest('./temp/')) | |
.on ('end', function () { | |
console.log(fileList); | |
}); | |
}) | |
//altro approccio | |
gulp.task('cover', "Run test code coverage and outputs an html report", [], () => { | |
var through = require('through2'); | |
var assemblies = [`../**/bin/${config.buildConfiguration}/*.Test.dll`] | |
gulp.src(assemblies) | |
.pipe(concatNames()) | |
.on('data', names => { | |
console.log(names) | |
}) | |
function concatNames() { | |
var names = [] | |
function bufferContents(file, enc, cb) { | |
names.push(file.path) | |
cb(null) | |
} | |
function endStream() { | |
this.emit('data', names.join(' ')); | |
this.emit('end'); | |
} | |
return through.obj(bufferContents, endStream); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment