karma-sonarqube-reporter
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -108,3 +108,3 @@ var fs = require('fs'); | ||
function createOutputFolder(outputFolder) { | ||
mkdirp(outputFolder, (error) => { | ||
mkdirp.sync(outputFolder, (error) => { | ||
if (error) { | ||
@@ -111,0 +111,0 @@ throw error |
{ | ||
"name": "karma-sonarqube-reporter", | ||
"version": "1.0.2", | ||
"description": "A karma reporter plugin which generates unit test reports for sonarqube.", | ||
"version": "1.0.3", | ||
"description": "A karma reporter plugin for generating Sonarqube generic test reports", | ||
"main": "index.js", | ||
@@ -6,0 +6,0 @@ "scripts": { |
# karma-sonarqube-reporter | ||
A [Karma][1] reporter plugin for generating [SonarQube][2] generic test execution data. | ||
A [Karma][1] reporter plugin for generating [SonarQube][2] generic test reports. | ||
@@ -9,4 +9,2 @@ [](https://travis-ci.org/fadc80/karma-sonarqube-reporter) | ||
Just save the `karma-sonarqube-reporter` as a development dependency | ||
`npm install karma-sonarqube-reporter --save-dev` | ||
@@ -37,3 +35,3 @@ | ||
**Enable the `sonarqube` reporter** | ||
**Activate `sonarqube` reporter** | ||
@@ -44,3 +42,3 @@ ```typescript | ||
Check a [karma.conf.js][3] full example | ||
Click [here][3] to see full `karma.conf.js` example | ||
@@ -47,0 +45,0 @@ |
var mock = require('mock-require'); | ||
var testData = { | ||
@@ -10,3 +11,4 @@ 'path/t1.spec.js':'describe("s1", function() { it("d1", function() {}); });', | ||
var pathFinder; | ||
beforeEach(function() { | ||
beforeAll(function() { | ||
mock('glob', { | ||
@@ -17,2 +19,3 @@ sync: function(pattern) { | ||
}); | ||
mock('fs', { | ||
@@ -23,4 +26,11 @@ readFileSync: function(path, encoding) { | ||
}); | ||
pathFinder = require('../../lib/path-finder'); | ||
pathFinder = mock.reRequire('../../lib/path-finder'); | ||
}); | ||
afterAll(function() { | ||
mock.stop('glob'); | ||
mock.stop('fs'); | ||
}); | ||
it('1st test file match suite s1 and description d1', function() { | ||
@@ -30,2 +40,3 @@ expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
}); | ||
it('2sd test file match suite s2 and description d2', function() { | ||
@@ -35,2 +46,3 @@ expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
}); | ||
it('3rd test file match suite s3 and description d3', function() { | ||
@@ -40,2 +52,3 @@ expect(pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
}); | ||
it('Test file not found', function() { | ||
@@ -45,3 +58,2 @@ expect(function() { pathFinder.testFilePath('**/*.spec.ts', 'utf-8', | ||
}); | ||
}); |
@@ -5,5 +5,7 @@ var reportBuilder = require('../../lib/report-builder'); | ||
var report; | ||
beforeEach(function() { | ||
report = reportBuilder.createReport(); | ||
}); | ||
describe('Creating a new empty report', function() { | ||
@@ -13,11 +15,15 @@ it ('Report defined', function() { | ||
}); | ||
it ('Report version defined as attribute', function() { | ||
expect(report['@'].version).toBeDefined(); | ||
}); | ||
it ('Report version is equal to 1', function() { | ||
expect(report['@'].version).toBe('1'); | ||
}); | ||
it ('Report files defined as an array', function() { | ||
expect(Array.isArray(report.file)).toBe(true); | ||
}); | ||
it ('Report files is empty', function() { | ||
@@ -27,16 +33,22 @@ expect(report.file.length).toBe(0); | ||
}); | ||
describe('Creating a report for a single test file', function() { | ||
const path = 'path/to/single/report'; | ||
beforeEach(function() { | ||
report.file.push(reportBuilder.createReportFile(path)); | ||
}); | ||
it ('Report file defined', function() { | ||
expect(report.file[0]).toBeDefined(); | ||
}); | ||
it ('Report file path defined as attribute', function() { | ||
expect(report.file[0]['@'].path).toBeDefined(); | ||
}); | ||
it ('Report file path defined correctly', function() { | ||
expect(report.file[0]['@'].path).toBe(path); | ||
}); | ||
it ('Report contains a single test file', function() { | ||
@@ -43,0 +55,0 @@ expect(report.file.length).toBe(1); |
Sorry, the diff of this file is not supported yet
18423
15
443
73
3