grunt-karma-sonar
Advanced tools
Comparing version 0.2.26 to 0.2.27
@@ -0,1 +1,7 @@ | ||
<a name="0.2.27"></a> | ||
# 0.2.26 (2017-04-26) | ||
## Bugfix | ||
- Fix unit failures can be more than one per testcase | ||
<a name="0.2.26"></a> | ||
@@ -2,0 +8,0 @@ # 0.2.26 (2016-05-18) |
{ | ||
"name": "grunt-karma-sonar", | ||
"description": "Grunt plugin for integrating karma reports with sonar", | ||
"version": "0.2.26", | ||
"version": "0.2.27", | ||
"homepage": "https://github.com/mdasberg/grunt-karma-sonar", | ||
@@ -32,3 +32,3 @@ "author": { | ||
"devDependencies": { | ||
"angular-test-setup": "0.1.5", | ||
"angular-test-setup": "0.1.8", | ||
"buffer-equal": "1.0.0", | ||
@@ -35,0 +35,0 @@ "fs": "0.0.2", |
@@ -29,3 +29,3 @@ (function () { | ||
var content = grunt.file.read(cwd + file). | ||
replace(new RegExp('(SF:)(.*?' + l.src + ')(.*)', 'g'), '$1.' + path.sep + 'src$3'); | ||
replace(new RegExp('(SF:)(.*?' + l.src + ')(.*)', 'g'), '$1.' + path.sep + l.src + '$3'); | ||
@@ -32,0 +32,0 @@ // #3 |
@@ -46,2 +46,3 @@ /*jshint -W083 */ | ||
glob.sync('**/*.feature', {cwd: testDir, root: '/'}).forEach(function (file) { | ||
var tests = [], | ||
@@ -48,0 +49,0 @@ content = grunt.file.read(testDir + path.sep + file), |
@@ -58,10 +58,15 @@ /*jshint -W083 */ | ||
var tc = {name: name, duration: duration > 0 ? duration : 0}, | ||
failure = testcase.childrenNamed('failure'), | ||
var tc = { | ||
name: name, | ||
duration: duration > 0 ? duration : 0, | ||
failure: [] | ||
}, | ||
failures = testcase.childrenNamed('failure'), | ||
skipped = testcase.childrenNamed('skipped'), | ||
error = testcase.childrenNamed('error'); | ||
if (failure.length === 1) { | ||
tc.failure = failure[0].val; | ||
} | ||
failures.forEach(function (failure) { | ||
tc.failure.push(failure.val); | ||
}); | ||
if (skipped.length === 1) { | ||
@@ -73,2 +78,3 @@ tc.skipped = skipped[0].val; | ||
} | ||
// #2 | ||
@@ -85,4 +91,15 @@ fileMatch.testcases.push(tc); | ||
fileContent = fileContent.concat('<testCase name="' + testcase.name + '" duration="' + testcase.duration + '"'); | ||
if (testcase.failure) { | ||
fileContent = fileContent.concat('><failure message="">' + testcase.failure + '</failure></testCase>'); | ||
if (testcase.failure.length > 0) { | ||
testcase.failure.forEach(function (failure) { | ||
fileContent = fileContent.concat('><failure message="">' + failure + '</failure>'); | ||
}); | ||
fileContent = fileContent.concat('</testCase>'); | ||
} else if (testcase.skipped !== undefined) { | ||
fileContent = fileContent.concat('><skipped message=""/>'); | ||
fileContent = fileContent.concat('</testCase>'); | ||
} else if (testcase.error !== undefined) { | ||
fileContent = fileContent.concat('><error message="">' + testcase.error + '</error>'); | ||
fileContent = fileContent.concat('</testCase>'); | ||
} else { | ||
@@ -89,0 +106,0 @@ fileContent = fileContent.concat('/>'); |
@@ -41,5 +41,5 @@ /*globals process */ | ||
var base = path.basename(file, extension); | ||
if(extension === '.js') { | ||
if (extension === '.js') { | ||
destination = destinationDirectory + path.sep + path.basename(base.replace(/\./g, '_') + extension); | ||
} else if(extension === '.feature') { | ||
} else if (extension === '.feature') { | ||
destination = destinationDirectory + path.sep + path.basename(base.concat(extension).replace(/\./g, '_') + '.js'); | ||
@@ -83,3 +83,3 @@ } | ||
'-Dsonar.javascript.jstestdriver.reportsPath=results', | ||
'-Dsonar.genericcoverage.unitTestReportPaths='+ 'results' + path.sep + 'TESTS-junit.xml', | ||
'-Dsonar.genericcoverage.unitTestReportPaths=' + 'results' + path.sep + 'TESTS-junit.xml', | ||
'-Dsonar.javascript.jstestdriver.itReportsPath=results', | ||
@@ -186,23 +186,25 @@ '-Dsonar.javascript.lcov.reportPath=' + 'results' + path.sep + 'coverage_report.lcov', | ||
testGlobs = []; | ||
data.paths.forEach(function (p) { | ||
var cwd = p.cwd ? p.cwd : '.'; | ||
sourceGlobs.push({cwd: cwd + path.sep + p.src, src: '**/*.*'}); | ||
testGlobs.push({cwd: cwd + path.sep + p.test, src: '**/*.js'}); | ||
testGlobs.push({cwd: cwd + path.sep + p.test, src: '**/*.feature'}); | ||
copyFiles({ | ||
cwd: cwd + path.sep + p.src, | ||
src: '**/*.*' | ||
}, sonarOptions.defaultOutputDir, p.src); | ||
copyFiles({ | ||
cwd: cwd + path.sep + p.test, | ||
src: '**/*.js' | ||
}, sonarOptions.defaultOutputDir, p.test); | ||
copyFiles({ | ||
cwd: cwd + path.sep + p.test, | ||
src: '**/*.feature' | ||
}, sonarOptions.defaultOutputDir, p.test); | ||
}); | ||
sourceGlobs.forEach(function (g) { | ||
copyFiles(g, sonarOptions.defaultOutputDir, 'src'); | ||
}); | ||
testGlobs.forEach(function (g) { | ||
copyFiles(g, sonarOptions.defaultOutputDir, 'test'); | ||
}); | ||
callback(null, 200); | ||
}, | ||
// #6 | ||
publish: function (callback) { | ||
var extension = (/^win/.test(process.platform) ? '.bat': ''); | ||
var extension = (/^win/.test(process.platform) ? '.bat' : ''); | ||
var opts = { | ||
@@ -215,11 +217,14 @@ cmd: 'sonar-runner' + extension, | ||
}; | ||
var libDir = path.join(__dirname, '..', 'lib'); | ||
if (grunt.file.exists(libDir)) { | ||
glob.sync('**/bin/sonar-runner' + extension, {cwd: libDir, root: '/'}).forEach(function (file) { | ||
glob.sync('**/bin/sonar-runner' + extension, { | ||
cwd: libDir, | ||
root: '/' | ||
}).forEach(function (file) { | ||
opts.cmd = libDir + path.sep + file; | ||
}); | ||
} | ||
// Add custom properties | ||
@@ -231,3 +236,3 @@ if (sonarOptions.runnerProperties) { | ||
} | ||
// enable debug | ||
@@ -237,3 +242,3 @@ if (sonarOptions.debug) { | ||
} | ||
if (!sonarOptions.dryRun) { | ||
@@ -240,0 +245,0 @@ if (sonarOptions.debug) { |
AI-detected possible typosquat
Supply chain riskAI has identified this package as a potential typosquat of a more popular package. This suggests that the package may be intentionally mimicking another package's name, description, or other metadata.
Found 1 instance in 1 package
62307
965
1