Skip to content

guilhem-lk/mocha-sonar-generic-test-coverage

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Introduction

This is a mocha reporter project to integrate mocha unit tests to sonar Generic Test coverage unit tests execution results

This reporter is only for unit test sucess/failures verification, to unit test line coverage take a look on istanbul reporter

Installation

npm install mocha-json-report --save-dev

On pure mocha

mocha --reporter mocha-sonar-generic-test-coverage testFolder

On mocha-test for use with grunt

mochaTest: {
	coverage: {
		options: {
			reporter: 'mocha-sonar-generic-test-coverage',
			quiet: true,
			captureFile: 'unit-tests.xml'
		},
		src: [
			'test.js'
		]
	}
}

Output example

<unitTest version="1">
	<file path="src/main/java/com/example/MyClass.java">
		<testCase name="test1" duration="500"/>
		<testCase name="test2" duration="600"/>
		<testCase name="test3" duration="600">
			<failure message="sort message">long stacktrace</failure>
		</testCase>
		<testCase name="test4" duration="600">
			<error message="sort message">long stacktrace</error>
		</testCase>
		<testCase name="test5" duration="600">
			<skipped message="sort message">long stacktrace</skipped>
		</testCase>
	</file>
</unitTest>

Sonar preview

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%