mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-16 06:17:10 +01:00
Merge pull request #44 from dorny/merge-multiple-reports
Paths with wildcard + merging multiple reports
This commit is contained in:
commit
967dbab3c6
22 changed files with 7450 additions and 210 deletions
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -24,5 +24,5 @@ jobs:
|
|||
uses: ./
|
||||
with:
|
||||
name: 'JEST Tests'
|
||||
path: '__tests__/__results__/jest-junit.xml'
|
||||
path: '__tests__/__results__/*.xml'
|
||||
reporter: 'jest-junit'
|
||||
|
|
|
|||
1
.gitignore
vendored
1
.gitignore
vendored
|
|
@ -99,5 +99,4 @@ __tests__/runner/*
|
|||
lib/**/*
|
||||
|
||||
# Project specific
|
||||
__tests__/__outputs__
|
||||
__tests__/__results__
|
||||
|
|
|
|||
38
__tests__/__outputs__/dart-json.md
Normal file
38
__tests__/__outputs__/dart-json.md
Normal file
|
|
@ -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
__tests__/__outputs__/dotnet-trx.md
Normal file
21
__tests__/__outputs__/dotnet-trx.md
Normal file
|
|
@ -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
__tests__/__outputs__/jest-junit.md
Normal file
38
__tests__/__outputs__/jest-junit.md
Normal file
|
|
@ -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 |
|
||||
|
|
@ -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> ❌
|
||||
|
|
|
|||
|
|
@ -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> ❌
|
||||
|
|
|
|||
|
|
@ -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> ❌
|
||||
|
|
|
|||
|
|
@ -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 () => {
|
||||
|
|
@ -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 ?? '')
|
||||
|
||||
|
|
|
|||
|
|
@ -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 () => {
|
||||
|
|
@ -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 ?? '')
|
||||
|
||||
|
|
|
|||
|
|
@ -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 () => {
|
||||
|
|
@ -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 ?? '')
|
||||
|
||||
|
|
|
|||
6818
dist/index.js
generated
vendored
6818
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load diff
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
411
dist/licenses.txt
generated
vendored
411
dist/licenses.txt
generated
vendored
|
|
@ -44,6 +44,81 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|||
@actions/io
|
||||
MIT
|
||||
|
||||
@nodelib/fs.scandir
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Denis Malinochkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
@nodelib/fs.stat
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Denis Malinochkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
@nodelib/fs.walk
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Denis Malinochkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
@octokit/auth-token
|
||||
MIT
|
||||
The MIT License
|
||||
|
|
@ -431,6 +506,31 @@ Apache-2.0
|
|||
limitations under the License.
|
||||
|
||||
|
||||
braces
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2018, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
deprecation
|
||||
ISC
|
||||
The ISC License
|
||||
|
|
@ -450,6 +550,167 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
fast-glob
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Denis Malinochkin
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
fastq
|
||||
ISC
|
||||
Copyright (c) 2015-2020, Matteo Collina <matteo.collina@gmail.com>
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
fill-range
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
glob-parent
|
||||
ISC
|
||||
The ISC License
|
||||
|
||||
Copyright (c) 2015, 2019 Elan Shanker
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
is-extglob
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2016, Jon Schlinkert
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
is-glob
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2017, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
is-number
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
is-plain-object
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
|
@ -475,6 +736,56 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
|
||||
merge2
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-2020 Teambition
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
micromatch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
node-fetch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
|
@ -520,6 +831,81 @@ ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
|||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
|
||||
picomatch
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
reusify
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015 Matteo Collina
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
||||
|
||||
|
||||
|
||||
run-parallel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) Feross Aboukhadijeh
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
sax
|
||||
ISC
|
||||
The ISC License
|
||||
|
|
@ -565,6 +951,31 @@ License, as follows:
|
|||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
|
||||
to-regex-range
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2015-present, Jon Schlinkert.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
|
||||
|
||||
tunnel
|
||||
MIT
|
||||
The MIT License (MIT)
|
||||
|
|
|
|||
27
src/main.ts
27
src/main.ts
|
|
@ -1,10 +1,12 @@
|
|||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
import * as fs from 'fs'
|
||||
import glob from 'fast-glob'
|
||||
import {parseDartJson} from './parsers/dart-json/dart-json-parser'
|
||||
import {parseDotnetTrx} from './parsers/dotnet-trx/dotnet-trx-parser'
|
||||
import {parseJestJunit} from './parsers/jest-junit/jest-junit-parser'
|
||||
import {ParseOptions, ParseTestResult} from './parsers/parser-types'
|
||||
import {getFileContent, normalizeDirPath} from './utils/file-utils'
|
||||
import {FileContent, ParseOptions, ParseTestResult} from './parsers/parser-types'
|
||||
import {normalizeDirPath} from './utils/file-utils'
|
||||
import {listFiles} from './utils/git'
|
||||
import {getCheckRunSha} from './utils/github-utils'
|
||||
|
||||
|
|
@ -26,6 +28,7 @@ async function main(): Promise<void> {
|
|||
const workDirInput = core.getInput('working-directory', {required: false})
|
||||
|
||||
if (workDirInput) {
|
||||
core.info(`Changing directory to ${workDirInput}`)
|
||||
process.chdir(workDirInput)
|
||||
}
|
||||
|
||||
|
|
@ -44,8 +47,14 @@ async function main(): Promise<void> {
|
|||
}
|
||||
|
||||
const parser = getParser(reporter)
|
||||
const content = getFileContent(path)
|
||||
const result = await parser(content, opts)
|
||||
const files = await getFiles(path)
|
||||
|
||||
if (files.length === 0) {
|
||||
core.setFailed(`No file matches path ${path}`)
|
||||
return
|
||||
}
|
||||
|
||||
const result = await parser(files, opts)
|
||||
const conclusion = result.success ? 'success' : 'failure'
|
||||
|
||||
await octokit.checks.create({
|
||||
|
|
@ -78,4 +87,14 @@ function getParser(reporter: string): ParseTestResult {
|
|||
}
|
||||
}
|
||||
|
||||
export async function getFiles(pattern: string): Promise<FileContent[]> {
|
||||
const paths = await glob(pattern, {dot: true})
|
||||
return Promise.all(
|
||||
paths.map(async path => {
|
||||
const content = await fs.promises.readFile(path, {encoding: 'utf8'})
|
||||
return {path, content}
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
run()
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
|
||||
import getReport from '../../report/get-report'
|
||||
import {normalizeFilePath} from '../../utils/file-utils'
|
||||
|
|
@ -28,7 +28,7 @@ import {
|
|||
} from '../../report/test-results'
|
||||
|
||||
class TestRun {
|
||||
constructor(readonly suites: TestSuite[], readonly success: boolean, readonly time: number) {}
|
||||
constructor(readonly path: string, readonly suites: TestSuite[], readonly success: boolean, readonly time: number) {}
|
||||
}
|
||||
|
||||
class TestSuite {
|
||||
|
|
@ -68,21 +68,23 @@ class TestCase {
|
|||
}
|
||||
}
|
||||
|
||||
export async function parseDartJson(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const testRun = getTestRun(content)
|
||||
const icon = testRun.success ? Icon.success : Icon.fail
|
||||
export async function parseDartJson(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const testRuns = files.map(f => getTestRun(f.path, f.content))
|
||||
const testRunsResults = testRuns.map(getTestRunResult)
|
||||
const success = testRuns.every(tr => tr.success)
|
||||
const icon = success ? Icon.success : Icon.fail
|
||||
|
||||
return {
|
||||
success: testRun.success,
|
||||
success,
|
||||
output: {
|
||||
title: `${options.name.trim()} ${icon}`,
|
||||
summary: getReport(getTestRunResult(testRun)),
|
||||
annotations: options.annotations ? getAnnotations(testRun, options.workDir, options.trackedFiles) : undefined
|
||||
summary: getReport(testRunsResults),
|
||||
annotations: options.annotations ? getAnnotations(testRuns, options.workDir, options.trackedFiles) : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTestRun(content: string): TestRun {
|
||||
function getTestRun(path: string, content: string): TestRun {
|
||||
const lines = content.split(/\n\r?/g).filter(line => line !== '')
|
||||
const events = lines.map(str => JSON.parse(str)) as ReportEvent[]
|
||||
|
||||
|
|
@ -112,7 +114,7 @@ function getTestRun(content: string): TestRun {
|
|||
}
|
||||
}
|
||||
|
||||
return new TestRun(Object.values(suites), success, totalTime)
|
||||
return new TestRun(path, Object.values(suites), success, totalTime)
|
||||
}
|
||||
|
||||
function getTestRunResult(tr: TestRun): TestRunResult {
|
||||
|
|
@ -120,7 +122,7 @@ function getTestRunResult(tr: TestRun): TestRunResult {
|
|||
return new TestSuiteResult(s.suite.path, getGroups(s))
|
||||
})
|
||||
|
||||
return new TestRunResult(suites, tr.time)
|
||||
return new TestRunResult(tr.path, suites, tr.time)
|
||||
}
|
||||
|
||||
function getGroups(suite: TestSuite): TestGroupResult[] {
|
||||
|
|
@ -134,8 +136,9 @@ function getGroups(suite: TestSuite): TestGroupResult[] {
|
|||
})
|
||||
}
|
||||
|
||||
function getAnnotations(tr: TestRun, workDir: string, trackedFiles: string[]): Annotation[] {
|
||||
function getAnnotations(testRuns: TestRun[], workDir: string, trackedFiles: string[]): Annotation[] {
|
||||
const annotations: Annotation[] = []
|
||||
for (const tr of testRuns) {
|
||||
for (const suite of tr.suites) {
|
||||
for (const group of Object.values(suite.groups)) {
|
||||
for (const test of group.tests) {
|
||||
|
|
@ -148,6 +151,7 @@ function getAnnotations(tr: TestRun, workDir: string, trackedFiles: string[]): A
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return annotations
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
import {ErrorInfo, Outcome, TestMethod, TrxReport} from './dotnet-trx-types'
|
||||
|
||||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
import {parseStringPromise} from 'xml2js'
|
||||
|
||||
import {normalizeFilePath} from '../../utils/file-utils'
|
||||
|
|
@ -41,27 +41,38 @@ class Test {
|
|||
}
|
||||
}
|
||||
|
||||
export async function parseDotnetTrx(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const trx = (await parseStringPromise(content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as TrxReport
|
||||
export async function parseDotnetTrx(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const testRuns: TestRunResult[] = []
|
||||
const testClasses: TestClass[] = []
|
||||
|
||||
const testClasses = getTestClasses(trx)
|
||||
const testRun = getTestRunResult(trx, testClasses)
|
||||
const success = testRun.result === 'success'
|
||||
for (const file of files) {
|
||||
const trx = await getTrxReport(file.content)
|
||||
const tc = getTestClasses(trx)
|
||||
const tr = getTestRunResult(file.path, trx, tc)
|
||||
testRuns.push(tr)
|
||||
testClasses.push(...tc)
|
||||
}
|
||||
|
||||
const success = testRuns.every(tr => tr.result === 'success')
|
||||
const icon = success ? Icon.success : Icon.fail
|
||||
|
||||
return {
|
||||
success,
|
||||
output: {
|
||||
title: `${options.name.trim()} ${icon}`,
|
||||
summary: getReport(testRun),
|
||||
summary: getReport(testRuns),
|
||||
annotations: options.annotations ? getAnnotations(testClasses, options.workDir, options.trackedFiles) : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getTestRunResult(trx: TrxReport, testClasses: TestClass[]): TestRunResult {
|
||||
async function getTrxReport(content: string): Promise<TrxReport> {
|
||||
return (await parseStringPromise(content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as TrxReport
|
||||
}
|
||||
|
||||
function getTestRunResult(path: string, trx: TrxReport, testClasses: TestClass[]): TestRunResult {
|
||||
const times = trx.TestRun.Times[0].$
|
||||
const totalTime = times.finish.getTime() - times.start.getTime()
|
||||
|
||||
|
|
@ -71,7 +82,7 @@ function getTestRunResult(trx: TrxReport, testClasses: TestClass[]): TestRunResu
|
|||
return new TestSuiteResult(tc.name, [group])
|
||||
})
|
||||
|
||||
return new TestRunResult(suites, totalTime)
|
||||
return new TestRunResult(path, suites, totalTime)
|
||||
}
|
||||
|
||||
function getTestClasses(trx: TrxReport): TestClass[] {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {Annotation, ParseOptions, TestResult} from '../parser-types'
|
||||
import {Annotation, FileContent, ParseOptions, TestResult} from '../parser-types'
|
||||
import {parseStringPromise} from 'xml2js'
|
||||
|
||||
import {JunitReport, TestCase, TestSuite} from './jest-junit-types'
|
||||
|
|
@ -15,25 +15,37 @@ import {
|
|||
} from '../../report/test-results'
|
||||
import getReport from '../../report/get-report'
|
||||
|
||||
export async function parseJestJunit(content: string, options: ParseOptions): Promise<TestResult> {
|
||||
const junit = (await parseStringPromise(content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as JunitReport
|
||||
const testsuites = junit.testsuites
|
||||
const success = !(testsuites.$?.failures > 0 || testsuites.$?.errors > 0)
|
||||
export async function parseJestJunit(files: FileContent[], options: ParseOptions): Promise<TestResult> {
|
||||
const junit: JunitReport[] = []
|
||||
const testRuns: TestRunResult[] = []
|
||||
|
||||
for (const file of files) {
|
||||
const ju = await getJunitReport(file.content)
|
||||
const tr = getTestRunResult(file.path, ju)
|
||||
junit.push(ju)
|
||||
testRuns.push(tr)
|
||||
}
|
||||
|
||||
const success = testRuns.every(tr => tr.result === 'success')
|
||||
const icon = success ? Icon.success : Icon.fail
|
||||
|
||||
return {
|
||||
success,
|
||||
output: {
|
||||
title: `${options.name.trim()} ${icon}`,
|
||||
summary: getSummary(junit),
|
||||
summary: getReport(testRuns),
|
||||
annotations: options.annotations ? getAnnotations(junit, options.workDir, options.trackedFiles) : undefined
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getSummary(junit: JunitReport): string {
|
||||
async function getJunitReport(content: string): Promise<JunitReport> {
|
||||
return (await parseStringPromise(content, {
|
||||
attrValueProcessors: [parseAttribute]
|
||||
})) as JunitReport
|
||||
}
|
||||
|
||||
function getTestRunResult(path: string, junit: JunitReport): TestRunResult {
|
||||
const suites = junit.testsuites.testsuite.map(ts => {
|
||||
const name = ts.$.name.trim()
|
||||
const time = ts.$.time * 1000
|
||||
|
|
@ -42,8 +54,7 @@ function getSummary(junit: JunitReport): string {
|
|||
})
|
||||
|
||||
const time = junit.testsuites.$.time * 1000
|
||||
const tr = new TestRunResult(suites, time)
|
||||
return getReport(tr)
|
||||
return new TestRunResult(path, suites, time)
|
||||
}
|
||||
|
||||
function getGroups(suite: TestSuite): TestGroupResult[] {
|
||||
|
|
@ -74,8 +85,9 @@ function getTestCaseResult(test: TestCase): TestExecutionResult {
|
|||
return 'success'
|
||||
}
|
||||
|
||||
function getAnnotations(junit: JunitReport, workDir: string, trackedFiles: string[]): Annotation[] {
|
||||
function getAnnotations(junitReports: JunitReport[], workDir: string, trackedFiles: string[]): Annotation[] {
|
||||
const annotations: Annotation[] = []
|
||||
for (const junit of junitReports) {
|
||||
for (const suite of junit.testsuites.testsuite) {
|
||||
for (const tc of suite.testcase) {
|
||||
if (!tc.failure) {
|
||||
|
|
@ -97,6 +109,7 @@ function getAnnotations(junit: JunitReport, workDir: string, trackedFiles: strin
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return annotations
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,9 @@ export type Annotation = {
|
|||
raw_details?: string
|
||||
}
|
||||
|
||||
export type ParseTestResult = (content: string, options: ParseOptions) => Promise<TestResult>
|
||||
export type ParseTestResult = (files: FileContent[], options: ParseOptions) => Promise<TestResult>
|
||||
|
||||
export type FileContent = {path: string; content: string}
|
||||
|
||||
export interface ParseOptions {
|
||||
name: string
|
||||
|
|
|
|||
|
|
@ -2,9 +2,21 @@ import {TestExecutionResult, TestRunResult, TestSuiteResult} from './test-result
|
|||
import {Align, Icon, link, table} from '../utils/markdown-utils'
|
||||
import {slug} from '../utils/slugger'
|
||||
|
||||
export default function getReport(tr: TestRunResult): string {
|
||||
export default function getReport(results: TestRunResult[]): string {
|
||||
const runsSummary = results.map(getRunSummary).join('\n\n')
|
||||
const suites = results
|
||||
.flatMap(tr => tr.suites)
|
||||
.map((ts, i) => getSuiteSummary(ts, i))
|
||||
.join('\n')
|
||||
|
||||
const suitesSection = `# Test Suites\n\n${suites}`
|
||||
return [runsSummary, suitesSection].join('\n\n')
|
||||
}
|
||||
|
||||
function getRunSummary(tr: TestRunResult): string {
|
||||
const time = `${(tr.time / 1000).toFixed(3)}s`
|
||||
const headingLine = `**${tr.tests}** tests were completed in **${time}** with **${tr.passed}** passed, **${tr.skipped}** skipped and **${tr.failed}** failed.`
|
||||
const headingLine1 = `### ${tr.path}`
|
||||
const headingLine2 = `**${tr.tests}** tests were completed in **${time}** with **${tr.passed}** passed, **${tr.skipped}** skipped and **${tr.failed}** failed.`
|
||||
|
||||
const suitesSummary = tr.suites.map((s, i) => {
|
||||
const icon = getResultIcon(s.result)
|
||||
|
|
@ -12,19 +24,16 @@ export default function getReport(tr: TestRunResult): string {
|
|||
const tsName = s.name
|
||||
const tsAddr = makeSuiteSlug(i, tsName).link
|
||||
const tsNameLink = link(tsName, tsAddr)
|
||||
return [icon, tsNameLink, s.tests, tsTime, s.passed, s.failed, s.skipped]
|
||||
return [icon, tsNameLink, s.tests, tsTime, s.passed, s.skipped, s.failed]
|
||||
})
|
||||
|
||||
const summary = table(
|
||||
['Result', 'Suite', 'Tests', 'Time', `Passed ${Icon.success}`, `Failed ${Icon.fail}`, `Skipped ${Icon.skip}`],
|
||||
['Result', 'Suite', 'Tests', 'Time', `Passed ${Icon.success}`, `Skipped ${Icon.skip}`, `Failed ${Icon.fail}`],
|
||||
[Align.Center, Align.Left, Align.Right, Align.Right, Align.Right, Align.Right, Align.Right],
|
||||
...suitesSummary
|
||||
)
|
||||
|
||||
const suites = tr.suites.map((ts, i) => getSuiteSummary(ts, i)).join('\n')
|
||||
const suitesSection = `# Test Suites\n\n${suites}`
|
||||
|
||||
return `${headingLine}\n${summary}\n${suitesSection}`
|
||||
return [headingLine1, headingLine2, summary].join('\n\n')
|
||||
}
|
||||
|
||||
function getSuiteSummary(ts: TestSuiteResult, index: number): string {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
export class TestRunResult {
|
||||
constructor(readonly suites: TestSuiteResult[], private totalTime?: number) {}
|
||||
constructor(readonly path: string, readonly suites: TestSuiteResult[], private totalTime?: number) {}
|
||||
|
||||
get tests(): number {
|
||||
return this.suites.reduce((sum, g) => sum + g.tests, 0)
|
||||
|
|
|
|||
|
|
@ -1,24 +1,10 @@
|
|||
import * as fs from 'fs'
|
||||
|
||||
export function getFileContent(path: string): string {
|
||||
if (!fs.existsSync(path)) {
|
||||
throw new Error(`File '${path}' not found`)
|
||||
}
|
||||
|
||||
if (!fs.lstatSync(path).isFile()) {
|
||||
throw new Error(`'${path}' is not a file`)
|
||||
}
|
||||
|
||||
return fs.readFileSync(path, {encoding: 'utf8'})
|
||||
}
|
||||
|
||||
export function normalizeDirPath(path: string, trailingSeparator: boolean): string {
|
||||
export function normalizeDirPath(path: string, addTrailingSlash: boolean): string {
|
||||
if (!path) {
|
||||
return path
|
||||
}
|
||||
|
||||
path = normalizeFilePath(path)
|
||||
if (trailingSeparator && !path.endsWith('/')) {
|
||||
if (addTrailingSlash && !path.endsWith('/')) {
|
||||
path += '/'
|
||||
}
|
||||
return path
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue