Skip to content

Commit

Permalink
Merge pull request #44 from dorny/merge-multiple-reports
Browse files Browse the repository at this point in the history
Paths with wildcard + merging multiple reports
  • Loading branch information
Michal Dorner authored and GitHub committed Jan 16, 2021
2 parents dfddea6 + 6e20ef2 commit 967dbab
Show file tree
Hide file tree
Showing 22 changed files with 10,481 additions and 3,241 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ jobs:
uses: ./
with:
name: 'JEST Tests'
path: '__tests__/__results__/jest-junit.xml'
path: '__tests__/__results__/*.xml'
reporter: 'jest-junit'
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,4 @@ __tests__/runner/*
lib/**/*

# Project specific
__tests__/__outputs__
__tests__/__results__
38 changes: 38 additions & 0 deletions __tests__/__outputs__/dart-json.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### fixtures/dart-json.json

**6** tests were completed in **3.760s** with **1** passed, **1** skipped and **4** failed.

| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
|| [test\main_test.dart](#ts-0-test-maintest-dart) | 4 | 74ms | 1 | 0 | 3 |
|| [test\second_test.dart](#ts-1-test-secondtest-dart) | 2 | 51ms | 0 | 1 | 1 |

# Test Suites

## <a id="user-content-ts-0-test-maintest-dart" href="#ts-0-test-maintest-dart">test\main_test.dart</a> ❌

### Test 1

| Result | Test | Time |
| :---: | :--- | ---: |
| ✔️ | Test 1 Passing test | 36ms |

### Test 1 Test 1.1

| Result | Test | Time |
| :---: | :--- | ---: |
|| Test 1 Test 1.1 Failing test | 20ms |
|| Test 1 Test 1.1 Exception in target unit | 6ms |

### Test 2

| Result | Test | Time |
| :---: | :--- | ---: |
|| Test 2 Exception in test | 12ms |

## <a id="user-content-ts-1-test-secondtest-dart" href="#ts-1-test-secondtest-dart">test\second_test.dart</a> ❌

| Result | Test | Time |
| :---: | :--- | ---: |
|| Timeout test | 37ms |
| ✖️ | Skipped test | 14ms |
21 changes: 21 additions & 0 deletions __tests__/__outputs__/dotnet-trx.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### fixtures/dotnet-trx.trx

**7** tests were completed in **1.061s** with **3** passed, **1** skipped and **3** failed.

| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
|| [DotnetTests.XUnitTests.CalculatorTests](#ts-0-DotnetTests-XUnitTests-CalculatorTests) | 7 | 109.5761ms | 3 | 1 | 3 |

# Test Suites

## <a id="user-content-ts-0-DotnetTests-XUnitTests-CalculatorTests" href="#ts-0-DotnetTests-XUnitTests-CalculatorTests">DotnetTests.XUnitTests.CalculatorTests</a> ❌

| Result | Test | Time |
| :---: | :--- | ---: |
|| Exception_In_TargetTest | 0.4975ms |
|| Exception_In_Test | 2.2728ms |
|| Failing_Test | 3.2953ms |
| ✔️ | Passing_Test | 0.1254ms |
| ✔️ | Passing_Test_With_Name | 0.103ms |
| ✖️ | Skipped_Test | 1ms |
| ✔️ | Timeout_Test | 102.2821ms |
38 changes: 38 additions & 0 deletions __tests__/__outputs__/jest-junit.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
### fixtures/jest-junit.xml

**6** tests were completed in **1.360s** with **1** passed, **1** skipped and **4** failed.

| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
|| [__tests__\main.test.js](#ts-0-tests-main-test-js) | 4 | 486ms | 1 | 0 | 3 |
|| [__tests__\second.test.js](#ts-1-tests-second-test-js) | 2 | 82ms | 0 | 1 | 1 |

# Test Suites

## <a id="user-content-ts-0-tests-main-test-js" href="#ts-0-tests-main-test-js">__tests__\main.test.js</a> ❌

### Test 1

| Result | Test | Time |
| :---: | :--- | ---: |
| ✔️ | Passing test | 1ms |

### Test 1 › Test 1.1

| Result | Test | Time |
| :---: | :--- | ---: |
|| Failing test | 2ms |
|| Exception in target unit | 0ms |

### Test 2

| Result | Test | Time |
| :---: | :--- | ---: |
|| Exception in test | 0ms |

## <a id="user-content-ts-1-tests-second-test-js" href="#ts-1-tests-second-test-js">__tests__\second.test.js</a> ❌

| Result | Test | Time |
| :---: | :--- | ---: |
|| Timeout test | 4ms |
| ✖️ | Skipped test | 0ms |
10 changes: 7 additions & 3 deletions __tests__/__snapshots__/dart-json.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,15 @@ dart:isolate _RawReceivePortImpl._handleMessage
"title": "[test\\\\second_test.dart] Timeout test",
},
],
"summary": "**6** tests were completed in **3.760s** with **1** passed, **1** skipped and **4** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Failed ❌ | Skipped ✖️ |
"summary": "### fixtures/dart-json.json
**6** tests were completed in **3.760s** with **1** passed, **1** skipped and **4** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
| ❌ | [test\\\\main_test.dart](#ts-0-test-maintest-dart) | 4 | 74ms | 1 | 3 | 0 |
| ❌ | [test\\\\main_test.dart](#ts-0-test-maintest-dart) | 4 | 74ms | 1 | 0 | 3 |
| ❌ | [test\\\\second_test.dart](#ts-1-test-secondtest-dart) | 2 | 51ms | 0 | 1 | 1 |
# Test Suites
## <a id=\\"user-content-ts-0-test-maintest-dart\\" href=\\"#ts-0-test-maintest-dart\\">test\\\\main_test.dart</a>
Expand Down
10 changes: 7 additions & 3 deletions __tests__/__snapshots__/dotnet-trx.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ Actual: 2",
"title": "[DotnetTests.XUnitTests.CalculatorTests] Failing_Test",
},
],
"summary": "**7** tests were completed in **1.061s** with **3** passed, **1** skipped and **3** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Failed| Skipped ✖️ |
"summary": "### fixtures/dotnet-trx.trx
**7** tests were completed in **1.061s** with **3** passed, **1** skipped and **3** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed|
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
|| [DotnetTests.XUnitTests.CalculatorTests](#ts-0-DotnetTests-XUnitTests-CalculatorTests) | 7 | 109.5761ms | 3 | 3 | 1 |
|| [DotnetTests.XUnitTests.CalculatorTests](#ts-0-DotnetTests-XUnitTests-CalculatorTests) | 7 | 109.5761ms | 3 | 1 | 3 |
# Test Suites
## <a id=\\"user-content-ts-0-DotnetTests-XUnitTests-CalculatorTests\\" href=\\"#ts-0-DotnetTests-XUnitTests-CalculatorTests\\">DotnetTests.XUnitTests.CalculatorTests</a>
Expand Down
10 changes: 7 additions & 3 deletions __tests__/__snapshots__/jest-junit.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ Received: false
"title": "[__tests__\\\\second.test.js] Timeout test",
},
],
"summary": "**6** tests were completed in **1.360s** with **1** passed, **1** skipped and **4** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Failed ❌ | Skipped ✖️ |
"summary": "### fixtures/jest-junit.xml
**6** tests were completed in **1.360s** with **1** passed, **1** skipped and **4** failed.
| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
| ❌ | [__tests__\\\\main.test.js](#ts-0-tests-main-test-js) | 4 | 486ms | 1 | 3 | 0 |
| ❌ | [__tests__\\\\main.test.js](#ts-0-tests-main-test-js) | 4 | 486ms | 1 | 0 | 3 |
| ❌ | [__tests__\\\\second.test.js](#ts-1-tests-second-test-js) | 2 | 82ms | 0 | 1 | 1 |
# Test Suites
## <a id=\\"user-content-ts-0-tests-main-test-js\\" href=\\"#ts-0-tests-main-test-js\\">__tests__\\\\main.test.js</a>
Expand Down
11 changes: 8 additions & 3 deletions __tests__/dart-json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import * as path from 'path'

import {parseDartJson} from '../src/parsers/dart-json/dart-json-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {normalizeFilePath} from '../src/utils/file-utils'

const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'dart-json.json'), {encoding: 'utf8'})
const outputPath = __dirname + '/__outputs__/dart-json.md'
const fixturePath = path.join(__dirname, 'fixtures', 'dart-json.json')
const outputPath = path.join(__dirname, '__outputs__', 'dart-json.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}

describe('dart-json tests', () => {
it('matches report snapshot', async () => {
Expand All @@ -16,7 +21,7 @@ describe('dart-json tests', () => {
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dart/'
}

const result = await parseDartJson(xmlFixture, opts)
const result = await parseDartJson([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')

Expand Down
11 changes: 8 additions & 3 deletions __tests__/dotnet-trx.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import * as path from 'path'

import {parseDotnetTrx} from '../src/parsers/dotnet-trx/dotnet-trx-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {normalizeFilePath} from '../src/utils/file-utils'

const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'dotnet-trx.trx'), {encoding: 'utf8'})
const outputPath = __dirname + '/__outputs__/dotnet-trx.md'
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-trx.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}

describe('dotnet-trx tests', () => {
it('matches report snapshot', async () => {
Expand All @@ -16,7 +21,7 @@ describe('dotnet-trx tests', () => {
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dotnet/'
}

const result = await parseDotnetTrx(xmlFixture, opts)
const result = await parseDotnetTrx([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')

Expand Down
11 changes: 8 additions & 3 deletions __tests__/jest-junit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ import * as path from 'path'

import {parseJestJunit} from '../src/parsers/jest-junit/jest-junit-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {normalizeFilePath} from '../src/utils/file-utils'

const xmlFixture = fs.readFileSync(path.join(__dirname, 'fixtures', 'jest-junit.xml'), {encoding: 'utf8'})
const outputPath = __dirname + '/__outputs__/jest-junit.md'
const fixturePath = path.join(__dirname, 'fixtures', 'jest-junit.xml')
const outputPath = path.join(__dirname, '__outputs__', 'jest-junit.md')
const xmlFixture = {
path: normalizeFilePath(path.relative(__dirname, fixturePath)),
content: fs.readFileSync(fixturePath, {encoding: 'utf8'})
}

describe('jest-junit tests', () => {
it('matches report snapshot', async () => {
Expand All @@ -16,7 +21,7 @@ describe('jest-junit tests', () => {
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/jest/'
}

const result = await parseJestJunit(xmlFixture, opts)
const result = await parseJestJunit([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')

Expand Down
Loading

0 comments on commit 967dbab

Please sign in to comment.