Add list-suites and list-tests options to limit report size

This commit is contained in:
Michal Dorner 2021-01-25 12:53:45 +01:00
parent 0919385c06
commit 3744805866
No known key found for this signature in database
GPG key ID: 9EEE04B48DA36786
20 changed files with 28593 additions and 18534 deletions

View file

@ -6,12 +6,12 @@
| 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\main_test.dart](#r0s0-test-maintest-dart) | 4 | 74ms | 1 | 0 | 3 |
| ❌ | [test\second_test.dart](#r0s1-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>
## <a id="user-content-r0s0-test-maintest-dart" href="#r0s0-test-maintest-dart">test\main_test.dart</a>
### Test 1
@ -32,7 +32,7 @@
| :---: | :--- | ---: |
| ❌ | 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>
## <a id="user-content-r0s1-test-secondtest-dart" href="#r0s1-test-secondtest-dart">test\second_test.dart</a>
| Result | Test | Time |
| :---: | :--- | ---: |

View file

@ -6,11 +6,11 @@
| Result | Suite | Tests | Time | Passed ✔️ | Skipped ✖️ | Failed ❌ |
| :---: | :--- | ---: | ---: | ---: | ---: | ---: |
| ❌ | [DotnetTests.XUnitTests.CalculatorTests](#ts-0-DotnetTests-XUnitTests-CalculatorTests) | 7 | 109.5761ms | 3 | 1 | 3 |
| ❌ | [DotnetTests.XUnitTests.CalculatorTests](#r0s0-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>
## <a id="user-content-r0s0-DotnetTests-XUnitTests-CalculatorTests" href="#r0s0-DotnetTests-XUnitTests-CalculatorTests">DotnetTests.XUnitTests.CalculatorTests</a>
| Result | Test | Time |
| :---: | :--- | ---: |

View file

@ -6,12 +6,12 @@
| 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 |
| ❌ | [__tests__\main.test.js](#r0s0-tests-main-test-js) | 4 | 486ms | 1 | 0 | 3 |
| ❌ | [__tests__\second.test.js](#r0s1-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>
## <a id="user-content-r0s0-tests-main-test-js" href="#r0s0-tests-main-test-js">__tests__\main.test.js</a>
### Test 1
@ -32,7 +32,7 @@
| :---: | :--- | ---: |
| ❌ | 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>
## <a id="user-content-r0s1-tests-second-test-js" href="#r0s1-tests-second-test-js">__tests__\second.test.js</a>
| Result | Test | Time |
| :---: | :--- | ---: |

File diff suppressed because it is too large Load diff

View file

@ -52,47 +52,75 @@ dart:isolate _RawReceivePortImpl._handleMessage
"title": "[test\\\\second_test.dart] Timeout test",
},
],
"summary": "![Tests failed](https://img.shields.io/badge/tests-1%20passed%2C%201%20skipped%2C%204%20failed-critical)
### 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 |
",
"title": "Dart tests ❌",
"testRuns": Array [
TestRunResult {
"path": "fixtures/dart-json.json",
"suites": Array [
TestSuiteResult {
"groups": Array [
TestGroupResult {
"name": "Test 1",
"tests": Array [
TestCaseResult {
"name": "Test 1 Passing test",
"result": "success",
"time": 36,
},
],
},
TestGroupResult {
"name": "Test 1 Test 1.1",
"tests": Array [
TestCaseResult {
"name": "Test 1 Test 1.1 Failing test",
"result": "failed",
"time": 20,
},
TestCaseResult {
"name": "Test 1 Test 1.1 Exception in target unit",
"result": "failed",
"time": 6,
},
],
},
TestGroupResult {
"name": "Test 2",
"tests": Array [
TestCaseResult {
"name": "Test 2 Exception in test",
"result": "failed",
"time": 12,
},
],
},
],
"name": "test\\\\main_test.dart",
"totalTime": undefined,
},
TestSuiteResult {
"groups": Array [
TestGroupResult {
"name": null,
"tests": Array [
TestCaseResult {
"name": "Timeout test",
"result": "failed",
"time": 37,
},
TestCaseResult {
"name": "Skipped test",
"result": "skipped",
"time": 14,
},
],
},
],
"name": "test\\\\second_test.dart",
"totalTime": undefined,
},
],
"totalTime": 3760,
},
],
}
`;

View file

@ -30,30 +30,59 @@ Actual: 2",
"title": "[DotnetTests.XUnitTests.CalculatorTests] Failing_Test",
},
],
"summary": "![Tests failed](https://img.shields.io/badge/tests-3%20passed%2C%201%20skipped%2C%203%20failed-critical)
### 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 |
",
"title": "Dotnet TRX tests ❌",
"testRuns": Array [
TestRunResult {
"path": "fixtures/dotnet-trx.trx",
"suites": Array [
TestSuiteResult {
"groups": Array [
TestGroupResult {
"name": null,
"tests": Array [
TestCaseResult {
"name": "Exception_In_TargetTest",
"result": "failed",
"time": 0.4975,
},
TestCaseResult {
"name": "Exception_In_Test",
"result": "failed",
"time": 2.2728,
},
TestCaseResult {
"name": "Failing_Test",
"result": "failed",
"time": 3.2953,
},
TestCaseResult {
"name": "Passing_Test",
"result": "success",
"time": 0.1254,
},
TestCaseResult {
"name": "Passing_Test_With_Name",
"result": "success",
"time": 0.103,
},
TestCaseResult {
"name": "Skipped_Test",
"result": "skipped",
"time": 1,
},
TestCaseResult {
"name": "Timeout_Test",
"result": "success",
"time": 102.2821,
},
],
},
],
"name": "DotnetTests.XUnitTests.CalculatorTests",
"totalTime": undefined,
},
],
"totalTime": 1061,
},
],
}
`;

File diff suppressed because it is too large Load diff

View file

@ -3,6 +3,7 @@ import * as path from 'path'
import {parseDartJson} from '../src/parsers/dart-json/dart-json-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/file-utils'
const fixturePath = path.join(__dirname, 'fixtures', 'dart-json.json')
@ -15,17 +16,16 @@ const xmlFixture = {
describe('dart-json tests', () => {
it('matches report snapshot', async () => {
const opts: ParseOptions = {
name: 'Dart tests',
annotations: true,
trackedFiles: ['lib/main.dart', 'test/main_test.dart', 'test/second_test.dart'],
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dart/'
}
const result = await parseDartJson([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')
expect(result).toMatchSnapshot()
expect(result.success).toBeFalsy()
expect(result?.output).toMatchSnapshot()
const report = getReport(result.testRuns)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})

View file

@ -3,6 +3,7 @@ import * as path from 'path'
import {parseDotnetTrx} from '../src/parsers/dotnet-trx/dotnet-trx-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/file-utils'
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-trx.trx')
@ -15,17 +16,16 @@ const xmlFixture = {
describe('dotnet-trx tests', () => {
it('matches report snapshot', async () => {
const opts: ParseOptions = {
name: 'Dotnet TRX tests',
annotations: true,
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.XUnitTests/CalculatorTests.cs'],
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/dotnet/'
}
const result = await parseDotnetTrx([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')
expect(result).toMatchSnapshot()
expect(result.success).toBeFalsy()
expect(result?.output).toMatchSnapshot()
const report = getReport(result.testRuns)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})

View file

@ -3,10 +3,10 @@ import * as path from 'path'
import {parseJestJunit} from '../src/parsers/jest-junit/jest-junit-parser'
import {ParseOptions} from '../src/parsers/parser-types'
import {getReport} from '../src/report/get-report'
import {normalizeFilePath} from '../src/utils/file-utils'
describe('jest-junit tests', () => {
it('report from ./reports/jest test results matches snapshot', async () => {
const fixturePath = path.join(__dirname, 'fixtures', 'jest-junit.xml')
const outputPath = path.join(__dirname, '__outputs__', 'jest-junit.md')
@ -16,18 +16,17 @@ describe('jest-junit tests', () => {
}
const opts: ParseOptions = {
name: 'jest tests',
annotations: true,
trackedFiles: ['__tests__/main.test.js', '__tests__/second.test.js', 'lib/main.js'],
workDir: 'C:/Users/Michal/Workspace/dorny/test-check/reports/jest/'
}
const result = await parseJestJunit([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')
expect(result).toMatchSnapshot()
expect(result.success).toBeFalsy()
expect(result?.output).toMatchSnapshot()
const report = getReport(result.testRuns)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
it('report from facebook/jest test results matches snapshot', async () => {
@ -42,16 +41,15 @@ describe('jest-junit tests', () => {
const trackedFiles = fs.readFileSync(filesPath, {encoding: 'utf8'}).split(/\n\r?/g)
const opts: ParseOptions = {
trackedFiles,
name: 'jest tests',
annotations: true,
workDir: '/home/dorny/dorny/jest/'
}
const result = await parseJestJunit([xmlFixture], opts)
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, result?.output?.summary ?? '')
expect(result).toMatchSnapshot()
expect(result.success).toBeFalsy()
expect(result?.output).toMatchSnapshot()
const report = getReport(result.testRuns, {listTests: 'only-failed'})
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
fs.writeFileSync(outputPath, report)
})
})