mirror of
https://github.com/dorny/test-reporter.git
synced 2025-12-15 22:07:09 +01:00
Merge branch 'upstream-main' into ritchxu/support-actions-summary
This commit is contained in:
commit
84e60bad69
37 changed files with 2141 additions and 1348 deletions
2
.github/workflows/check-dist.yml
vendored
2
.github/workflows/check-dist.yml
vendored
|
|
@ -46,7 +46,7 @@ jobs:
|
||||||
id: diff
|
id: diff
|
||||||
|
|
||||||
# If index.js was different than expected, upload the expected version as an artifact
|
# If index.js was different than expected, upload the expected version as an artifact
|
||||||
- uses: actions/upload-artifact@v3
|
- uses: actions/upload-artifact@v4
|
||||||
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
|
||||||
with:
|
with:
|
||||||
name: dist
|
name: dist
|
||||||
|
|
|
||||||
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
|
@ -25,7 +25,7 @@ jobs:
|
||||||
|
|
||||||
- name: Upload test results
|
- name: Upload test results
|
||||||
if: success() || failure()
|
if: success() || failure()
|
||||||
uses: actions/upload-artifact@v3
|
uses: actions/upload-artifact@v4
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
path: __tests__/__results__/*.xml
|
path: __tests__/__results__/*.xml
|
||||||
|
|
|
||||||
2
.nvmrc
2
.nvmrc
|
|
@ -1 +1 @@
|
||||||
v18.19.0
|
v20
|
||||||
|
|
|
||||||
28
README.md
28
README.md
|
|
@ -13,7 +13,7 @@ This [Github Action](https://github.com/features/actions) displays test results
|
||||||
|:--:|:--:|:--:|:--:|
|
|:--:|:--:|:--:|:--:|
|
||||||
|
|
||||||
**Supported languages / frameworks:**
|
**Supported languages / frameworks:**
|
||||||
- .NET / [xUnit](https://xunit.net/) / [NUnit](https://nunit.org/) / [MSTest](https://github.com/Microsoft/testfx-docs)
|
- .NET / [dotnet test](https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-test#examples) ( [xUnit](https://xunit.net/) / [NUnit](https://nunit.org/) / [MSTest](https://github.com/Microsoft/testfx-docs) )
|
||||||
- Dart / [test](https://pub.dev/packages/test)
|
- Dart / [test](https://pub.dev/packages/test)
|
||||||
- Flutter / [test](https://pub.dev/packages/test)
|
- Flutter / [test](https://pub.dev/packages/test)
|
||||||
- Java / [JUnit](https://junit.org/)
|
- Java / [JUnit](https://junit.org/)
|
||||||
|
|
@ -43,7 +43,7 @@ jobs:
|
||||||
name: Build & Test
|
name: Build & Test
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3 # checkout the repo
|
- uses: actions/checkout@v4 # checkout the repo
|
||||||
- run: npm ci # install packages
|
- run: npm ci # install packages
|
||||||
- run: npm test # run tests (configured to use jest-junit reporter)
|
- run: npm test # run tests (configured to use jest-junit reporter)
|
||||||
|
|
||||||
|
|
@ -74,10 +74,10 @@ jobs:
|
||||||
build-test:
|
build-test:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3 # checkout the repo
|
- uses: actions/checkout@v4 # checkout the repo
|
||||||
- run: npm ci # install packages
|
- run: npm ci # install packages
|
||||||
- run: npm test # run tests (configured to use jest-junit reporter)
|
- run: npm test # run tests (configured to use jest-junit reporter)
|
||||||
- uses: actions/upload-artifact@v3 # upload test results
|
- uses: actions/upload-artifact@v4 # upload test results
|
||||||
if: success() || failure() # run this step even if previous step failed
|
if: success() || failure() # run this step even if previous step failed
|
||||||
with:
|
with:
|
||||||
name: test-results
|
name: test-results
|
||||||
|
|
@ -137,11 +137,13 @@ jobs:
|
||||||
|
|
||||||
# Format of test results. Supported options:
|
# Format of test results. Supported options:
|
||||||
# dart-json
|
# dart-json
|
||||||
|
# dotnet-nunit
|
||||||
# dotnet-trx
|
# dotnet-trx
|
||||||
# flutter-json
|
# flutter-json
|
||||||
# java-junit
|
# java-junit
|
||||||
# jest-junit
|
# jest-junit
|
||||||
# mocha-json
|
# mocha-json
|
||||||
|
# rspec-json
|
||||||
reporter: ''
|
reporter: ''
|
||||||
|
|
||||||
# Allows you to generate only the summary.
|
# Allows you to generate only the summary.
|
||||||
|
|
@ -315,16 +317,22 @@ Configuration of `uniqueOutputName`, `suiteNameTemplate`, `classNameTemplate`, `
|
||||||
- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher
|
- Mocha version [v7.2.0](https://github.com/mochajs/mocha/releases/tag/v7.2.0) or higher
|
||||||
- Usage of [json](https://mochajs.org/#json) reporter.
|
- Usage of [json](https://mochajs.org/#json) reporter.
|
||||||
|
|
||||||
You can use the following example configuration in `package.json`:
|
For Mocha >= [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), you can use the following example configuration in `package.json`:
|
||||||
|
```json
|
||||||
|
"scripts": {
|
||||||
|
"test": "mocha --reporter json --reporter-option output=test-results.json"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
For Mocha < v9.1, the command should look like this:
|
||||||
```json
|
```json
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "mocha --reporter json > test-results.json"
|
"test": "mocha --reporter json > test-results.json"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
Additionally, test processing might fail if any of your tests write anything on standard output.
|
||||||
Test processing might fail if any of your tests write anything on standard output.
|
Before version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0), Mocha doesn't have the option to store `json` output directly to the file, and we have to rely on redirecting its standard output ([mocha#4607](https://github.com/mochajs/mocha/pull/4607)).
|
||||||
Mocha, unfortunately, doesn't have the option to store `json` output directly to the file, and we have to rely on redirecting its standard output.
|
Please update Mocha to version [v9.1.0](https://github.com/mochajs/mocha/releases/tag/v9.1.0) or above if you encounter this issue.
|
||||||
There is a work in progress to fix it: [mocha#4607](https://github.com/mochajs/mocha/pull/4607)
|
|
||||||
</details>
|
</details>
|
||||||
|
|
||||||
<details>
|
<details>
|
||||||
|
|
@ -339,7 +347,7 @@ Unfortunately, there are some known issues and limitations caused by GitHub API:
|
||||||
|
|
||||||
- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.
|
- Test report (i.e. Check Run summary) is markdown text. No custom styling or HTML is possible.
|
||||||
- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.
|
- Maximum report size is 65535 bytes. Input parameters `list-suites` and `list-tests` will be automatically adjusted if max size is exceeded.
|
||||||
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v3` to upload them and inspect them manually.
|
- Test report can't reference any additional files (e.g. screenshots). You can use `actions/upload-artifact@v4` to upload them and inspect them manually.
|
||||||
- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more
|
- Check Runs are created for specific commit SHA. It's not possible to specify under which workflow test report should belong if more
|
||||||
workflows are running for the same SHA. Thanks to this GitHub "feature" it's possible your test report will appear in an unexpected place in GitHub UI.
|
workflows are running for the same SHA. Thanks to this GitHub "feature" it's possible your test report will appear in an unexpected place in GitHub UI.
|
||||||
For more information, see [#67](https://github.com/dorny/test-reporter/issues/67).
|
For more information, see [#67](https://github.com/dorny/test-reporter/issues/67).
|
||||||
|
|
|
||||||
31
__tests__/__outputs__/dotnet-nunit.md
Normal file
31
__tests__/__outputs__/dotnet-nunit.md
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|

|
||||||
|
|Report|Passed|Failed|Skipped|Time|
|
||||||
|
|:---|---:|---:|---:|---:|
|
||||||
|
|fixtures/dotnet-nunit.xml|3 ✅|5 ❌|1 ⚪|230ms|
|
||||||
|
## ❌ <a id="user-content-r0" href="#r0">fixtures/dotnet-nunit.xml</a>
|
||||||
|
**9** tests were completed in **230ms** with **3** passed, **5** failed and **1** skipped.
|
||||||
|
|Test suite|Passed|Failed|Skipped|Time|
|
||||||
|
|:---|---:|---:|---:|---:|
|
||||||
|
|[DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests](#r0s0)|3 ✅|5 ❌|1 ⚪|69ms|
|
||||||
|
### ❌ <a id="user-content-r0s0" href="#r0s0">DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests</a>
|
||||||
|
```
|
||||||
|
CalculatorTests
|
||||||
|
✅ Is_Even_Number(2)
|
||||||
|
❌ Is_Even_Number(3)
|
||||||
|
Expected: True
|
||||||
|
But was: False
|
||||||
|
|
||||||
|
❌ Exception_In_TargetTest
|
||||||
|
System.DivideByZeroException : Attempted to divide by zero.
|
||||||
|
❌ Exception_In_Test
|
||||||
|
System.Exception : Test
|
||||||
|
❌ Failing_Test
|
||||||
|
Expected: 3
|
||||||
|
But was: 2
|
||||||
|
|
||||||
|
✅ Passing_Test
|
||||||
|
✅ Passing_Test_With_Description
|
||||||
|
⚪ Skipped_Test
|
||||||
|
❌ Timeout_Test
|
||||||
|
|
||||||
|
```
|
||||||
19
__tests__/__outputs__/rspec-json.md
Normal file
19
__tests__/__outputs__/rspec-json.md
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|

|
||||||
|
|Report|Passed|Failed|Skipped|Time|
|
||||||
|
|:---|---:|---:|---:|---:|
|
||||||
|
|fixtures/rspec-json.json|1 ✅|1 ❌|1 ⚪|0ms|
|
||||||
|
## ❌ <a id="user-content-r0" href="#r0">fixtures/rspec-json.json</a>
|
||||||
|
**3** tests were completed in **0ms** with **1** passed, **1** failed and **1** skipped.
|
||||||
|
|Test suite|Passed|Failed|Skipped|Time|
|
||||||
|
|:---|---:|---:|---:|---:|
|
||||||
|
|[./spec/config/check_env_vars_spec.rb](#r0s0)|1 ✅|1 ❌|1 ⚪|0ms|
|
||||||
|
### ❌ <a id="user-content-r0s0" href="#r0s0">./spec/config/check_env_vars_spec.rb</a>
|
||||||
|
```
|
||||||
|
CheckEnvVars#call when all env vars are defined behaves like success load
|
||||||
|
❌ CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion
|
||||||
|
(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug("All config env vars exist")
|
||||||
|
expected: 0 times with arguments: ("All config env vars exist")
|
||||||
|
received: 1 time with arguments: ("All config env vars exist")
|
||||||
|
✅ CheckEnvVars#call when all env vars are defined behaves like success load logs success message
|
||||||
|
⚪ CheckEnvVars#call when all env vars are defined behaves like success load skips the test
|
||||||
|
```
|
||||||
|
|
@ -13,4 +13,5 @@ AcmeLibTests.AcmeLibTests
|
||||||
✅ test_always_pass
|
✅ test_always_pass
|
||||||
✅ test_always_skip
|
✅ test_always_skip
|
||||||
❌ test_always_fail
|
❌ test_always_fail
|
||||||
|
failed
|
||||||
```
|
```
|
||||||
107
__tests__/__snapshots__/dotnet-nunit.test.ts.snap
Normal file
107
__tests__/__snapshots__/dotnet-nunit.test.ts.snap
Normal file
|
|
@ -0,0 +1,107 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`dotnet-nunit tests report from ./reports/dotnet test results matches snapshot 1`] = `
|
||||||
|
TestRunResult {
|
||||||
|
"path": "fixtures/dotnet-nunit.xml",
|
||||||
|
"suites": [
|
||||||
|
TestSuiteResult {
|
||||||
|
"groups": [
|
||||||
|
TestGroupResult {
|
||||||
|
"name": "CalculatorTests",
|
||||||
|
"tests": [
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "Is_Even_Number(2)",
|
||||||
|
"result": "success",
|
||||||
|
"time": 0.622,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": " at DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number(Int32 i) in C:\\Users\\Michal\\Workspace\\dorny\\test-reporter\\reports\\dotnet\\DotnetTests.NUnitV3Tests\\CalculatorTests.cs:line 61
|
||||||
|
",
|
||||||
|
"line": undefined,
|
||||||
|
"message": " Expected: True
|
||||||
|
But was: False
|
||||||
|
",
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "Is_Even_Number(3)",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 1.098,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": " at DotnetTests.Unit.Calculator.Div(Int32 a, Int32 b) in C:\\Users\\Michal\\Workspace\\dorny\\test-reporter\\reports\\dotnet\\DotnetTests.Unit\\Calculator.cs:line 9
|
||||||
|
at DotnetTests.XUnitTests.CalculatorTests.Exception_In_TargetTest() in C:\\Users\\Michal\\Workspace\\dorny\\test-reporter\\reports\\dotnet\\DotnetTests.NUnitV3Tests\\CalculatorTests.cs:line 33",
|
||||||
|
"line": undefined,
|
||||||
|
"message": "System.DivideByZeroException : Attempted to divide by zero.",
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "Exception_In_TargetTest",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 22.805,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": " at DotnetTests.XUnitTests.CalculatorTests.Exception_In_Test() in C:\\Users\\Michal\\Workspace\\dorny\\test-reporter\\reports\\dotnet\\DotnetTests.NUnitV3Tests\\CalculatorTests.cs:line 39",
|
||||||
|
"line": undefined,
|
||||||
|
"message": "System.Exception : Test",
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "Exception_In_Test",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 0.528,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": " at DotnetTests.XUnitTests.CalculatorTests.Failing_Test() in C:\\Users\\Michal\\Workspace\\dorny\\test-reporter\\reports\\dotnet\\DotnetTests.NUnitV3Tests\\CalculatorTests.cs:line 27
|
||||||
|
",
|
||||||
|
"line": undefined,
|
||||||
|
"message": " Expected: 3
|
||||||
|
But was: 2
|
||||||
|
",
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "Failing_Test",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 28.162,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "Passing_Test",
|
||||||
|
"result": "success",
|
||||||
|
"time": 0.23800000000000002,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "Passing_Test_With_Description",
|
||||||
|
"result": "success",
|
||||||
|
"time": 0.135,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "Skipped_Test",
|
||||||
|
"result": "skipped",
|
||||||
|
"time": 0.398,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": "",
|
||||||
|
"line": undefined,
|
||||||
|
"message": "",
|
||||||
|
"path": undefined,
|
||||||
|
},
|
||||||
|
"name": "Timeout_Test",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 14.949,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"name": "DotnetTests.NUnitV3Tests.dll.DotnetTests.XUnitTests",
|
||||||
|
"totalTime": undefined,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"totalTime": 230.30800000000002,
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
@ -41,7 +41,7 @@ at java.lang.Thread.run(Thread.java:748)
|
||||||
|
|
||||||
",
|
",
|
||||||
"line": 29,
|
"line": 29,
|
||||||
"message": undefined,
|
"message": "java.lang.AssertionError: expected [1.2.1] but found [1.2.0]",
|
||||||
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
||||||
},
|
},
|
||||||
"name": "testVersionStrings",
|
"name": "testVersionStrings",
|
||||||
|
|
@ -100,7 +100,7 @@ at java.lang.Thread.run(Thread.java:748)
|
||||||
|
|
||||||
",
|
",
|
||||||
"line": 29,
|
"line": 29,
|
||||||
"message": undefined,
|
"message": "java.lang.AssertionError: expected [1.2.1] but found [1.2.0]",
|
||||||
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
"path": "pulsar-common/src/test/java/org/apache/pulsar/AddMissingPatchVersionTest.java",
|
||||||
},
|
},
|
||||||
"name": "testVersionStrings",
|
"name": "testVersionStrings",
|
||||||
|
|
|
||||||
49
__tests__/__snapshots__/rspec-json.test.ts.snap
Normal file
49
__tests__/__snapshots__/rspec-json.test.ts.snap
Normal file
|
|
@ -0,0 +1,49 @@
|
||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`rspec-json tests report from ./reports/rspec-json test results matches snapshot 1`] = `
|
||||||
|
TestRunResult {
|
||||||
|
"path": "fixtures/rspec-json.json",
|
||||||
|
"suites": [
|
||||||
|
TestSuiteResult {
|
||||||
|
"groups": [
|
||||||
|
TestGroupResult {
|
||||||
|
"name": "CheckEnvVars#call when all env vars are defined behaves like success load",
|
||||||
|
"tests": [
|
||||||
|
TestCaseResult {
|
||||||
|
"error": {
|
||||||
|
"details": "/usr/local/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1603:in \`initialize'
|
||||||
|
./config/check_env_vars.rb:11:in \`call'
|
||||||
|
./spec/config/check_env_vars_spec.rb:7:in \`block (3 levels) in <top (required)>'
|
||||||
|
./spec/config/check_env_vars_spec.rb:19:in \`block (4 levels) in <top (required)>'",
|
||||||
|
"line": 11,
|
||||||
|
"message": "(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug("All config env vars exist")
|
||||||
|
expected: 0 times with arguments: ("All config env vars exist")
|
||||||
|
received: 1 time with arguments: ("All config env vars exist")",
|
||||||
|
"path": "./config/check_env_vars.rb",
|
||||||
|
},
|
||||||
|
"name": "CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion",
|
||||||
|
"result": "failed",
|
||||||
|
"time": 0.004411051,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "CheckEnvVars#call when all env vars are defined behaves like success load logs success message",
|
||||||
|
"result": "success",
|
||||||
|
"time": 0.079159625,
|
||||||
|
},
|
||||||
|
TestCaseResult {
|
||||||
|
"error": undefined,
|
||||||
|
"name": "CheckEnvVars#call when all env vars are defined behaves like success load skips the test",
|
||||||
|
"result": "skipped",
|
||||||
|
"time": 0.000023007,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"name": "./spec/config/check_env_vars_spec.rb",
|
||||||
|
"totalTime": undefined,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"totalTime": 0.19118387,
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
|
@ -25,7 +25,7 @@ TestRunResult {
|
||||||
"error": {
|
"error": {
|
||||||
"details": undefined,
|
"details": undefined,
|
||||||
"line": undefined,
|
"line": undefined,
|
||||||
"message": undefined,
|
"message": "failed",
|
||||||
"path": undefined,
|
"path": undefined,
|
||||||
},
|
},
|
||||||
"name": "test_always_fail",
|
"name": "test_always_fail",
|
||||||
|
|
|
||||||
29
__tests__/dotnet-nunit.test.ts
Normal file
29
__tests__/dotnet-nunit.test.ts
Normal file
|
|
@ -0,0 +1,29 @@
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
|
import {DotnetNunitParser} from '../src/parsers/dotnet-nunit/dotnet-nunit-parser'
|
||||||
|
import {ParseOptions} from '../src/test-parser'
|
||||||
|
import {getReport} from '../src/report/get-report'
|
||||||
|
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||||
|
|
||||||
|
describe('dotnet-nunit tests', () => {
|
||||||
|
it('report from ./reports/dotnet test results matches snapshot', async () => {
|
||||||
|
const fixturePath = path.join(__dirname, 'fixtures', 'dotnet-nunit.xml')
|
||||||
|
const outputPath = path.join(__dirname, '__outputs__', 'dotnet-nunit.md')
|
||||||
|
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||||
|
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||||
|
|
||||||
|
const opts: ParseOptions = {
|
||||||
|
parseErrors: true,
|
||||||
|
trackedFiles: ['DotnetTests.Unit/Calculator.cs', 'DotnetTests.NUnitV3Tests/CalculatorTests.cs']
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new DotnetNunitParser(opts)
|
||||||
|
const result = await parser.parse(filePath, fileContent)
|
||||||
|
expect(result).toMatchSnapshot()
|
||||||
|
|
||||||
|
const report = getReport([result])
|
||||||
|
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||||
|
fs.writeFileSync(outputPath, report)
|
||||||
|
})
|
||||||
|
})
|
||||||
112
__tests__/fixtures/dotnet-nunit.xml
Normal file
112
__tests__/fixtures/dotnet-nunit.xml
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<test-run id="0" runstate="Runnable" testcasecount="9" result="Failed" total="9" passed="3" failed="5" inconclusive="0" skipped="1" asserts="5" engine-version="3.12.0.0" clr-version="3.1.16" start-time="2021-06-28 20:23:41Z" end-time="2021-06-28 20:23:41Z" duration="0.230308">
|
||||||
|
<command-line><![CDATA[C:\Users\Michal\.dotnet\tools\.store\nunit.consolerunner.netcore\3.12.0-beta2\nunit.consolerunner.netcore\3.12.0-beta2\tools\netcoreapp3.1\any\nunit3-console.dll reports/dotnet/DotnetTests.NUnitV3Tests/bin/Debug/netcoreapp3.1/DotnetTests.NUnitV3Tests.dll --result=__tests__/fixtures/dotnet-nunit.xml]]></command-line>
|
||||||
|
<test-suite type="Assembly" id="1-1011" name="DotnetTests.NUnitV3Tests.dll" fullname="C:/Users/Michal/Workspace/dorny/test-reporter/reports/dotnet/DotnetTests.NUnitV3Tests/bin/Debug/netcoreapp3.1/DotnetTests.NUnitV3Tests.dll" runstate="Runnable" testcasecount="9" result="Failed" site="Child" start-time="2021-06-28T20:23:41.4594179Z" end-time="2021-06-28T20:23:41.5420313Z" duration="0.082553" total="9" passed="3" failed="5" warnings="0" inconclusive="0" skipped="1" asserts="5">
|
||||||
|
<environment framework-version="3.13.2.0" clr-version="3.1.16" os-version="Microsoft Windows 10.0.19041" platform="Win32NT" cwd="C:\Users\Michal\Workspace\dorny\test-reporter" machine-name="DORNY-PC" user="Michal" user-domain="DORNY-PC" culture="sk-SK" uiculture="en-US" os-architecture="x64" />
|
||||||
|
<settings>
|
||||||
|
<setting name="DisposeRunners" value="True" />
|
||||||
|
<setting name="WorkDirectory" value="C:\Users\Michal\Workspace\dorny\test-reporter" />
|
||||||
|
<setting name="NumberOfTestWorkers" value="4" />
|
||||||
|
</settings>
|
||||||
|
<properties>
|
||||||
|
<property name="_PID" value="30996" />
|
||||||
|
<property name="_APPDOMAIN" value="nunit3-console" />
|
||||||
|
</properties>
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[One or more child tests had errors]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-suite type="TestSuite" id="1-1012" name="DotnetTests" fullname="DotnetTests" runstate="Runnable" testcasecount="9" result="Failed" site="Child" start-time="2021-06-28T20:23:41.4647482Z" end-time="2021-06-28T20:23:41.5420271Z" duration="0.077277" total="9" passed="3" failed="5" warnings="0" inconclusive="0" skipped="1" asserts="5">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[One or more child tests had errors]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-suite type="TestSuite" id="1-1013" name="XUnitTests" fullname="DotnetTests.XUnitTests" runstate="Runnable" testcasecount="9" result="Failed" site="Child" start-time="2021-06-28T20:23:41.4649710Z" end-time="2021-06-28T20:23:41.5420231Z" duration="0.077053" total="9" passed="3" failed="5" warnings="0" inconclusive="0" skipped="1" asserts="5">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[One or more child tests had errors]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-suite type="TestFixture" id="1-1000" name="CalculatorTests" fullname="DotnetTests.XUnitTests.CalculatorTests" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" testcasecount="9" result="Failed" site="Child" start-time="2021-06-28T20:23:41.4661195Z" end-time="2021-06-28T20:23:41.5420143Z" duration="0.075896" total="9" passed="3" failed="5" warnings="0" inconclusive="0" skipped="1" asserts="5">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[One or more child tests had errors]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-case id="1-1004" name="Exception_In_TargetTest" fullname="DotnetTests.XUnitTests.CalculatorTests.Exception_In_TargetTest" methodname="Exception_In_TargetTest" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="2033520428" result="Failed" label="Error" start-time="2021-06-28T20:23:41.4684284Z" end-time="2021-06-28T20:23:41.4911288Z" duration="0.022805" asserts="0">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[System.DivideByZeroException : Attempted to divide by zero.]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.Unit.Calculator.Div(Int32 a, Int32 b) in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.Unit\Calculator.cs:line 9
|
||||||
|
at DotnetTests.XUnitTests.CalculatorTests.Exception_In_TargetTest() in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 33]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1-1005" name="Exception_In_Test" fullname="DotnetTests.XUnitTests.CalculatorTests.Exception_In_Test" methodname="Exception_In_Test" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="145176317" result="Failed" label="Error" start-time="2021-06-28T20:23:41.4930398Z" end-time="2021-06-28T20:23:41.4935666Z" duration="0.000528" asserts="0">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[System.Exception : Test]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.XUnitTests.CalculatorTests.Exception_In_Test() in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 39]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1-1003" name="Failing_Test" fullname="DotnetTests.XUnitTests.CalculatorTests.Failing_Test" methodname="Failing_Test" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="189717168" result="Failed" start-time="2021-06-28T20:23:41.4935910Z" end-time="2021-06-28T20:23:41.5217516Z" duration="0.028162" asserts="1">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[ Expected: 3
|
||||||
|
But was: 2
|
||||||
|
]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.XUnitTests.CalculatorTests.Failing_Test() in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 27
|
||||||
|
]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
<assertions>
|
||||||
|
<assertion result="Failed">
|
||||||
|
<message><![CDATA[ Expected: 3
|
||||||
|
But was: 2
|
||||||
|
]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.XUnitTests.CalculatorTests.Failing_Test() in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 27
|
||||||
|
]]></stack-trace>
|
||||||
|
</assertion>
|
||||||
|
</assertions>
|
||||||
|
</test-case>
|
||||||
|
<test-suite type="Theory" id="1-1010" name="Is_Even_Number" fullname="DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" testcasecount="2" result="Failed" site="Child" start-time="2021-06-28T20:23:41.5217837Z" end-time="2021-06-28T20:23:41.5251025Z" duration="0.003318" total="2" passed="1" failed="1" warnings="0" inconclusive="0" skipped="0" asserts="2">
|
||||||
|
<properties>
|
||||||
|
<property name="_JOINTYPE" value="Combinatorial" />
|
||||||
|
</properties>
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[One or more child tests had errors]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-case id="1-1008" name="Is_Even_Number(2)" fullname="DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number(2)" methodname="Is_Even_Number" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="2002556739" result="Passed" start-time="2021-06-28T20:23:41.5222381Z" end-time="2021-06-28T20:23:41.5228607Z" duration="0.000622" asserts="1" />
|
||||||
|
<test-case id="1-1009" name="Is_Even_Number(3)" fullname="DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number(3)" methodname="Is_Even_Number" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="1722214143" result="Failed" start-time="2021-06-28T20:23:41.5228803Z" end-time="2021-06-28T20:23:41.5239781Z" duration="0.001098" asserts="1">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[ Expected: True
|
||||||
|
But was: False
|
||||||
|
]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number(Int32 i) in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 61
|
||||||
|
]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
<assertions>
|
||||||
|
<assertion result="Failed">
|
||||||
|
<message><![CDATA[ Expected: True
|
||||||
|
But was: False
|
||||||
|
]]></message>
|
||||||
|
<stack-trace><![CDATA[ at DotnetTests.XUnitTests.CalculatorTests.Is_Even_Number(Int32 i) in C:\Users\Michal\Workspace\dorny\test-reporter\reports\dotnet\DotnetTests.NUnitV3Tests\CalculatorTests.cs:line 61
|
||||||
|
]]></stack-trace>
|
||||||
|
</assertion>
|
||||||
|
</assertions>
|
||||||
|
</test-case>
|
||||||
|
</test-suite>
|
||||||
|
<test-case id="1-1001" name="Passing_Test" fullname="DotnetTests.XUnitTests.CalculatorTests.Passing_Test" methodname="Passing_Test" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="550330290" result="Passed" start-time="2021-06-28T20:23:41.5260365Z" end-time="2021-06-28T20:23:41.5262756Z" duration="0.000238" asserts="1" />
|
||||||
|
<test-case id="1-1002" name="Passing_Test_With_Description" fullname="DotnetTests.XUnitTests.CalculatorTests.Passing_Test_With_Description" methodname="Passing_Test_With_Description" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="1693317298" result="Passed" start-time="2021-06-28T20:23:41.5263998Z" end-time="2021-06-28T20:23:41.5265354Z" duration="0.000135" asserts="1">
|
||||||
|
<properties>
|
||||||
|
<property name="Description" value="Some description" />
|
||||||
|
</properties>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1-1007" name="Skipped_Test" fullname="DotnetTests.XUnitTests.CalculatorTests.Skipped_Test" methodname="Skipped_Test" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Ignored" seed="1512653931" result="Skipped" label="Ignored" start-time="2021-06-28T20:23:41.5265550Z" end-time="2021-06-28T20:23:41.5269525Z" duration="0.000398" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="_SKIPREASON" value="Skipped" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[Skipped]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1-1006" name="Timeout_Test" fullname="DotnetTests.XUnitTests.CalculatorTests.Timeout_Test" methodname="Timeout_Test" classname="DotnetTests.XUnitTests.CalculatorTests" runstate="Runnable" seed="258810529" result="Failed" label="Test exceeded Timeout value 1ms." start-time="2021-06-28T20:23:41.5269651Z" end-time="2021-06-28T20:23:41.5419118Z" duration="0.014949" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Timeout" value="1" />
|
||||||
|
</properties>
|
||||||
|
<failure />
|
||||||
|
</test-case>
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
</test-run>
|
||||||
|
|
@ -1,9 +1,15 @@
|
||||||
{"protocolVersion":"0.1.1","runnerVersion":"1.15.4","pid":21320,"type":"start","time":0}
|
{"protocolVersion":"0.1.1","runnerVersion":"1.25.3","pid":7103,"type":"start","time":0}
|
||||||
{"suite":{"id":0,"platform":"vm","path":"test\\main_test.dart"},"type":"suite","time":0}
|
{"suite":{"id":0,"platform":"vm","path":"test/second_test.dart"},"type":"suite","time":0}
|
||||||
{"test":{"id":1,"name":"loading test\\main_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":1}
|
{"test":{"id":1,"name":"loading test/second_test.dart","suiteID":0,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":0}
|
||||||
{"suite":{"id":2,"platform":"vm","path":"test\\second_test.dart"},"type":"suite","time":11}
|
{"suite":{"id":2,"platform":"vm","path":"test/main_test.dart"},"type":"suite","time":4}
|
||||||
{"test":{"id":3,"name":"loading test\\second_test.dart","suiteID":2,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":11}
|
{"test":{"id":3,"name":"loading test/main_test.dart","suiteID":2,"groupIDs":[],"metadata":{"skip":false,"skipReason":null},"line":null,"column":null,"url":null},"type":"testStart","time":4}
|
||||||
{"count":2,"type":"allSuites","time":11}
|
{"count":2,"time":5,"type":"allSuites"}
|
||||||
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":4018}
|
{"testID":1,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":294}
|
||||||
{"testID":3,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":4025}
|
{"testID":3,"messageType":"print","message":"Hello from the test","type":"print","time":297}
|
||||||
{"success":true,"type":"done","time":4029}
|
{"testID":3,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":321}
|
||||||
|
{"group":{"id":4,"suiteID":2,"parentID":null,"name":"","metadata":{"skip":false,"skipReason":null},"testCount":0,"line":null,"column":null,"url":null},"type":"group","time":322}
|
||||||
|
{"test":{"id":5,"name":"(setUpAll)","suiteID":2,"groupIDs":[4],"metadata":{"skip":false,"skipReason":null},"line":6,"column":3,"url":"file:///Users/domu/Downloads/test-reporter/reports/dart/test/main_test.dart"},"type":"testStart","time":322}
|
||||||
|
{"testID":5,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":330}
|
||||||
|
{"test":{"id":6,"name":"(tearDownAll)","suiteID":2,"groupIDs":[4],"metadata":{"skip":false,"skipReason":null},"line":7,"column":3,"url":"file:///Users/domu/Downloads/test-reporter/reports/dart/test/main_test.dart"},"type":"testStart","time":330}
|
||||||
|
{"testID":6,"result":"success","skipped":false,"hidden":true,"type":"testDone","time":331}
|
||||||
|
{"success":true,"type":"done","time":333}
|
||||||
|
|
|
||||||
17
__tests__/fixtures/empty/rspec-json.json
Normal file
17
__tests__/fixtures/empty/rspec-json.json
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
{
|
||||||
|
"version": "3.13.0",
|
||||||
|
"messages": [
|
||||||
|
"No examples found."
|
||||||
|
],
|
||||||
|
"examples": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"summary": {
|
||||||
|
"duration": 0.002514266,
|
||||||
|
"example_count": 0,
|
||||||
|
"failure_count": 0,
|
||||||
|
"pending_count": 0,
|
||||||
|
"errors_outside_of_examples_count": 0
|
||||||
|
},
|
||||||
|
"summary_line": "0 examples, 0 failures"
|
||||||
|
}
|
||||||
125
__tests__/fixtures/external/nunit-sample.xml
vendored
Normal file
125
__tests__/fixtures/external/nunit-sample.xml
vendored
Normal file
|
|
@ -0,0 +1,125 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
||||||
|
<test-run id="2" name="mock-assembly.dll" fullname="D:\Dev\NUnit\nunit-3.0\work\bin\vs2008\Debug\mock-assembly.dll" testcasecount="25" result="Failed" time="0.154" total="18" passed="12" failed="2" inconclusive="1" skipped="3" asserts="2" run-date="2011-07-26" start-time="11:34:27">
|
||||||
|
<environment nunit-version="1.0.0.0" clr-version="2.0.50727.4961" os-version="Microsoft Windows NT 6.1.7600.0" platform="Win32NT" cwd="D:\Dev\NUnit\nunit-3.0\work\bin\vs2008\Debug" machine-name="CHARLIE-LAPTOP" user="charlie" user-domain="charlie-laptop" culture="en-US" uiculture="en-US" />
|
||||||
|
<test-suite type="Assembly" id="1036" name="mock-assembly.dll" fullname="D:\Dev\NUnit\nunit-3.0\work\bin\vs2008\Debug\mock-assembly.dll" testcasecount="25" result="Failed" time="0.154" total="18" passed="12" failed="2" inconclusive="1" skipped="3" asserts="2">
|
||||||
|
<properties>
|
||||||
|
<property name="_PID" value="11928" />
|
||||||
|
<property name="_APPDOMAIN" value="test-domain-mock-assembly.dll" />
|
||||||
|
</properties>
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[Child test failed]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-suite type="TestFixture" id="1000" name="MockTestFixture" fullname="NUnit.Tests.Assemblies.MockTestFixture" testcasecount="11" result="Failed" time="0.119" total="10" passed="4" failed="2" inconclusive="1" skipped="3" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Category" value="FixtureCategory" />
|
||||||
|
<property name="Description" value="Fake Test Fixture" />
|
||||||
|
</properties>
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[Child test failed]]></message>
|
||||||
|
</failure>
|
||||||
|
<test-case id="1005" name="FailingTest" fullname="NUnit.Tests.Assemblies.MockTestFixture.FailingTest" result="Failed" time="0.023" asserts="0">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[Intentional failure]]></message>
|
||||||
|
<stack-trace><![CDATA[ at NUnit.Framework.Assert.Fail(String message, Object[] args) in D:\Dev\NUnit\nunit-3.0\work\NUnitFramework\src\framework\Assert.cs:line 142
|
||||||
|
at NUnit.Framework.Assert.Fail(String message) in D:\Dev\NUnit\nunit-3.0\work\NUnitFramework\src\framework\Assert.cs:line 152
|
||||||
|
at NUnit.Tests.Assemblies.MockTestFixture.FailingTest() in D:\Dev\NUnit\nunit-3.0\work\NUnitFramework\src\mock-assembly\MockAssembly.cs:line 121]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1010" name="InconclusiveTest" fullname="NUnit.Tests.Assemblies.MockTestFixture.InconclusiveTest" result="Inconclusive" time="0.001" asserts="0" />
|
||||||
|
<test-case id="1001" name="MockTest1" fullname="NUnit.Tests.Assemblies.MockTestFixture.MockTest1" result="Passed" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Description" value="Mock Test #1" />
|
||||||
|
</properties>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1002" name="MockTest2" fullname="NUnit.Tests.Assemblies.MockTestFixture.MockTest2" result="Passed" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Severity" value="Critical" />
|
||||||
|
<property name="Description" value="This is a really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really, really long description" />
|
||||||
|
<property name="Category" value="MockCategory" />
|
||||||
|
</properties>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1003" name="MockTest3" fullname="NUnit.Tests.Assemblies.MockTestFixture.MockTest3" result="Passed" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Category" value="AnotherCategory" />
|
||||||
|
<property name="Category" value="MockCategory" />
|
||||||
|
</properties>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1007" name="MockTest4" fullname="NUnit.Tests.Assemblies.MockTestFixture.MockTest4" result="Skipped" label="Ignored" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="Category" value="Foo" />
|
||||||
|
<property name="_SKIPREASON" value="ignoring this test method for now" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[ignoring this test method for now]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1004" name="MockTest5" fullname="NUnit.Tests.Assemblies.MockTestFixture.MockTest5" result="Skipped" label="Invalid" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="_SKIPREASON" value="Method is not public" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[Method is not public]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1009" name="NotRunnableTest" fullname="NUnit.Tests.Assemblies.MockTestFixture.NotRunnableTest" result="Skipped" label="Invalid" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="_SKIPREASON" value="No arguments were provided" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[No arguments were provided]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1011" name="TestWithException" fullname="NUnit.Tests.Assemblies.MockTestFixture.TestWithException" result="Failed" label="Error" time="0.002" asserts="0">
|
||||||
|
<failure>
|
||||||
|
<message><![CDATA[System.ApplicationException : Intentional Exception]]></message>
|
||||||
|
<stack-trace><![CDATA[ at NUnit.Tests.Assemblies.MockTestFixture.MethodThrowsException() in D:\Dev\NUnit\nunit-3.0\work\NUnitFramework\src\mock-assembly\MockAssembly.cs:line 158
|
||||||
|
at NUnit.Tests.Assemblies.MockTestFixture.TestWithException() in D:\Dev\NUnit\nunit-3.0\work\NUnitFramework\src\mock-assembly\MockAssembly.cs:line 153]]></stack-trace>
|
||||||
|
</failure>
|
||||||
|
</test-case>
|
||||||
|
<test-case id="1006" name="TestWithManyProperties" fullname="NUnit.Tests.Assemblies.MockTestFixture.TestWithManyProperties" result="Passed" time="0.000" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="TargetMethod" value="SomeClassName" />
|
||||||
|
<property name="Size" value="5" />
|
||||||
|
</properties>
|
||||||
|
</test-case>
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1023" name="BadFixture" fullname="NUnit.Tests.BadFixture" testcasecount="1" result="Skipped" label="Invalid" time="0.000" total="0" passed="0" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="_SKIPREASON" value="No suitable constructor was found" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[No suitable constructor was found]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1025" name="FixtureWithTestCases" fullname="NUnit.Tests.FixtureWithTestCases" testcasecount="2" result="Passed" time="0.010" total="2" passed="2" failed="0" inconclusive="0" skipped="0" asserts="2">
|
||||||
|
<test-suite type="ParameterizedMethod" id="1026" name="MethodWithParameters" fullname="NUnit.Tests.FixtureWithTestCases.MethodWithParameters" testcasecount="2" result="Passed" time="0.009" total="2" passed="2" failed="0" inconclusive="0" skipped="0" asserts="2">
|
||||||
|
<test-case id="1027" name="MethodWithParameters(2,2)" fullname="NUnit.Tests.FixtureWithTestCases.MethodWithParameters(2,2)" result="Passed" time="0.006" asserts="1" />
|
||||||
|
<test-case id="1028" name="MethodWithParameters(9,11)" fullname="NUnit.Tests.FixtureWithTestCases.MethodWithParameters(9,11)" result="Passed" time="0.000" asserts="1" />
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1016" name="IgnoredFixture" fullname="NUnit.Tests.IgnoredFixture" testcasecount="3" result="Skipped" label="Ignored" time="0.000" total="0" passed="0" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<properties>
|
||||||
|
<property name="_SKIPREASON" value="" />
|
||||||
|
</properties>
|
||||||
|
<reason>
|
||||||
|
<message><![CDATA[]]></message>
|
||||||
|
</reason>
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="ParameterizedFixture" id="1029" name="ParameterizedFixture" fullname="NUnit.Tests.ParameterizedFixture" testcasecount="4" result="Passed" time="0.007" total="4" passed="4" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<test-suite type="TestFixture" id="1030" name="ParameterizedFixture(42)" fullname="NUnit.Tests.ParameterizedFixture(42)" testcasecount="2" result="Passed" time="0.003" total="2" passed="2" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<test-case id="1031" name="Test1" fullname="NUnit.Tests.ParameterizedFixture(42).Test1" result="Passed" time="0.000" asserts="0" />
|
||||||
|
<test-case id="1032" name="Test2" fullname="NUnit.Tests.ParameterizedFixture(42).Test2" result="Passed" time="0.000" asserts="0" />
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1033" name="ParameterizedFixture(5)" fullname="NUnit.Tests.ParameterizedFixture(5)" testcasecount="2" result="Passed" time="0.002" total="2" passed="2" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<test-case id="1034" name="Test1" fullname="NUnit.Tests.ParameterizedFixture(5).Test1" result="Passed" time="0.000" asserts="0" />
|
||||||
|
<test-case id="1035" name="Test2" fullname="NUnit.Tests.ParameterizedFixture(5).Test2" result="Passed" time="0.000" asserts="0" />
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1012" name="OneTestCase" fullname="NUnit.Tests.Singletons.OneTestCase" testcasecount="1" result="Passed" time="0.001" total="1" passed="1" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<test-case id="1013" name="TestCase" fullname="NUnit.Tests.Singletons.OneTestCase.TestCase" result="Passed" time="0.000" asserts="0" />
|
||||||
|
</test-suite>
|
||||||
|
<test-suite type="TestFixture" id="1014" name="MockTestFixture" fullname="NUnit.Tests.TestAssembly.MockTestFixture" testcasecount="1" result="Passed" time="0.001" total="1" passed="1" failed="0" inconclusive="0" skipped="0" asserts="0">
|
||||||
|
<test-case id="1015" name="MyTest" fullname="NUnit.Tests.TestAssembly.MockTestFixture.MyTest" result="Passed" time="0.001" asserts="0" />
|
||||||
|
</test-suite>
|
||||||
|
</test-suite>
|
||||||
|
</test-run>
|
||||||
53
__tests__/fixtures/rspec-json.json
Normal file
53
__tests__/fixtures/rspec-json.json
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
{
|
||||||
|
"version": "3.13.0",
|
||||||
|
"examples": [
|
||||||
|
{
|
||||||
|
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:1]",
|
||||||
|
"description": "logs success message",
|
||||||
|
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load logs success message",
|
||||||
|
"status": "passed",
|
||||||
|
"file_path": "./spec/config/check_env_vars_spec.rb",
|
||||||
|
"line_number": 12,
|
||||||
|
"run_time": 0.079159625,
|
||||||
|
"pending_message": null
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:2]",
|
||||||
|
"description": "fails in assertion",
|
||||||
|
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load fails in assertion",
|
||||||
|
"status": "failed",
|
||||||
|
"file_path": "./spec/config/check_env_vars_spec.rb",
|
||||||
|
"line_number": 17,
|
||||||
|
"run_time": 0.004411051,
|
||||||
|
"pending_message": null,
|
||||||
|
"exception": {
|
||||||
|
"class": "RSpec::Mocks::MockExpectationError",
|
||||||
|
"message": "(#ActiveSupport::BroadcastLogger:0x00007f1007fedf58).debug(\"All config env vars exist\")\n expected: 0 times with arguments: (\"All config env vars exist\")\n received: 1 time with arguments: (\"All config env vars exist\")",
|
||||||
|
"backtrace": [
|
||||||
|
"/usr/local/bundle/ruby/3.3.0/gems/net-http-0.4.1/lib/net/http.rb:1603:in `initialize'",
|
||||||
|
"./config/check_env_vars.rb:11:in `call'",
|
||||||
|
"./spec/config/check_env_vars_spec.rb:7:in `block (3 levels) in \u003ctop (required)\u003e'",
|
||||||
|
"./spec/config/check_env_vars_spec.rb:19:in `block (4 levels) in \u003ctop (required)\u003e'"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"id": "./spec/config/check_env_vars_spec.rb[1:1:1:1:4]",
|
||||||
|
"description": "skips the test",
|
||||||
|
"full_description": "CheckEnvVars#call when all env vars are defined behaves like success load skips the test",
|
||||||
|
"status": "pending",
|
||||||
|
"file_path": "./spec/config/check_env_vars_spec.rb",
|
||||||
|
"line_number": 27,
|
||||||
|
"run_time": 2.3007e-05,
|
||||||
|
"pending_message": "Temporarily skipped with xit"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"summary": {
|
||||||
|
"duration": 0.19118387,
|
||||||
|
"example_count": 3,
|
||||||
|
"failure_count": 1,
|
||||||
|
"pending_count": 1,
|
||||||
|
"errors_outside_of_examples_count": 0
|
||||||
|
},
|
||||||
|
"summary_line": "3 examples, 1 failures, 1 pending"
|
||||||
|
}
|
||||||
45
__tests__/rspec-json.test.ts
Normal file
45
__tests__/rspec-json.test.ts
Normal file
|
|
@ -0,0 +1,45 @@
|
||||||
|
import * as fs from 'fs'
|
||||||
|
import * as path from 'path'
|
||||||
|
|
||||||
|
import {RspecJsonParser} from '../src/parsers/rspec-json/rspec-json-parser'
|
||||||
|
import {ParseOptions} from '../src/test-parser'
|
||||||
|
import {getReport} from '../src/report/get-report'
|
||||||
|
import {normalizeFilePath} from '../src/utils/path-utils'
|
||||||
|
|
||||||
|
describe('rspec-json tests', () => {
|
||||||
|
it('produces empty test run result when there are no test cases', async () => {
|
||||||
|
const fixturePath = path.join(__dirname, 'fixtures', 'empty', 'rspec-json.json')
|
||||||
|
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||||
|
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||||
|
|
||||||
|
const opts: ParseOptions = {
|
||||||
|
parseErrors: true,
|
||||||
|
trackedFiles: []
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new RspecJsonParser(opts)
|
||||||
|
const result = await parser.parse(filePath, fileContent)
|
||||||
|
expect(result.tests).toBe(0)
|
||||||
|
expect(result.result).toBe('success')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('report from ./reports/rspec-json test results matches snapshot', async () => {
|
||||||
|
const fixturePath = path.join(__dirname, 'fixtures', 'rspec-json.json')
|
||||||
|
const outputPath = path.join(__dirname, '__outputs__', 'rspec-json.md')
|
||||||
|
const filePath = normalizeFilePath(path.relative(__dirname, fixturePath))
|
||||||
|
const fileContent = fs.readFileSync(fixturePath, {encoding: 'utf8'})
|
||||||
|
|
||||||
|
const opts: ParseOptions = {
|
||||||
|
parseErrors: true,
|
||||||
|
trackedFiles: ['test/main.test.js', 'test/second.test.js', 'lib/main.js']
|
||||||
|
}
|
||||||
|
|
||||||
|
const parser = new RspecJsonParser(opts)
|
||||||
|
const result = await parser.parse(filePath, fileContent)
|
||||||
|
expect(result).toMatchSnapshot()
|
||||||
|
|
||||||
|
const report = getReport([result])
|
||||||
|
fs.mkdirSync(path.dirname(outputPath), {recursive: true})
|
||||||
|
fs.writeFileSync(outputPath, report)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
@ -26,11 +26,13 @@ inputs:
|
||||||
description: |
|
description: |
|
||||||
Format of test results. Supported options:
|
Format of test results. Supported options:
|
||||||
- dart-json
|
- dart-json
|
||||||
|
- dotnet-nunit
|
||||||
- dotnet-trx
|
- dotnet-trx
|
||||||
- flutter-json
|
- flutter-json
|
||||||
- java-junit
|
- java-junit
|
||||||
- jest-junit
|
- jest-junit
|
||||||
- mocha-json
|
- mocha-json
|
||||||
|
- rspec-json
|
||||||
- swift-xunit
|
- swift-xunit
|
||||||
required: true
|
required: true
|
||||||
list-suites:
|
list-suites:
|
||||||
|
|
|
||||||
1199
dist/index.js
generated
vendored
1199
dist/index.js
generated
vendored
File diff suppressed because it is too large
Load diff
785
package-lock.json
generated
785
package-lock.json
generated
File diff suppressed because it is too large
Load diff
40
package.json
40
package.json
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "test-check",
|
"name": "test-reporter",
|
||||||
"version": "1.8.0",
|
"version": "2.0.0-preview",
|
||||||
"private": true,
|
"private": true,
|
||||||
"description": "Presents test results from popular testing frameworks as Github check run",
|
"description": "Presents test results from popular testing frameworks as Github check run",
|
||||||
"main": "lib/main.js",
|
"main": "lib/main.js",
|
||||||
|
|
@ -16,12 +16,13 @@
|
||||||
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
|
"all": "npm run build && npm run format && npm run lint && npm run package && npm test",
|
||||||
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
|
"dart-fixture": "cd \"reports/dart\" && dart test --file-reporter=\"json:../../__tests__/fixtures/dart-json.json\"",
|
||||||
"dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
|
"dotnet-fixture": "dotnet test reports/dotnet/DotnetTests.XUnitTests --logger \"trx;LogFileName=../../../../__tests__/fixtures/dotnet-trx.trx\"",
|
||||||
|
"dotnet-nunit-fixture": "nunit.exe reports/dotnet/DotnetTests.NUnitV3Tests/bin/Debug/netcoreapp3.1/DotnetTests.NUnitV3Tests.dll --result=__tests__/fixtures/dotnet-nunit.xml",
|
||||||
"jest-fixture": "cd \"reports/jest\" && npm test",
|
"jest-fixture": "cd \"reports/jest\" && npm test",
|
||||||
"mocha-fixture": "cd \"reports/mocha\" && npm test"
|
"mocha-fixture": "cd \"reports/mocha\" && npm test"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "git+https://github.com/dorny/test-check.git"
|
"url": "git+https://github.com/dorny/test-reporter.git"
|
||||||
},
|
},
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"actions",
|
"actions",
|
||||||
|
|
@ -35,39 +36,37 @@
|
||||||
"@actions/core": "^1.10.1",
|
"@actions/core": "^1.10.1",
|
||||||
"@actions/exec": "^1.1.1",
|
"@actions/exec": "^1.1.1",
|
||||||
"@actions/github": "^6.0.0",
|
"@actions/github": "^6.0.0",
|
||||||
"adm-zip": "^0.5.10",
|
"adm-zip": "^0.5.14",
|
||||||
"fast-glob": "^3.3.2",
|
"fast-glob": "^3.3.2",
|
||||||
"got": "^11.8.2",
|
"got": "^11.8.6",
|
||||||
"picomatch": "^3.0.1",
|
"picomatch": "^4.0.2",
|
||||||
"xml2js": "^0.6.2"
|
"xml2js": "^0.6.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@octokit/types": "^12.4.0",
|
"@octokit/webhooks-types": "^7.5.1",
|
||||||
"@octokit/webhooks": "^12.0.11",
|
|
||||||
"@octokit/webhooks-types": "^7.3.1",
|
|
||||||
"@types/adm-zip": "^0.5.5",
|
"@types/adm-zip": "^0.5.5",
|
||||||
"@types/github-slugger": "^1.3.0",
|
"@types/github-slugger": "^1.3.0",
|
||||||
"@types/jest": "^29.5.11",
|
"@types/jest": "^29.5.12",
|
||||||
"@types/node": "^20.11.9",
|
"@types/node": "^20.14.8",
|
||||||
"@types/picomatch": "^2.3.3",
|
"@types/picomatch": "^2.3.3",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"@typescript-eslint/eslint-plugin": "^6.19.1",
|
"@typescript-eslint/eslint-plugin": "^7.14.1",
|
||||||
"@typescript-eslint/parser": "^6.19.1",
|
"@typescript-eslint/parser": "^7.14.1",
|
||||||
"@vercel/ncc": "^0.38.1",
|
"@vercel/ncc": "^0.38.1",
|
||||||
"eol-converter-cli": "^1.0.8",
|
"eol-converter-cli": "^1.0.8",
|
||||||
"eslint": "^8.56.0",
|
"eslint": "^8.57.0",
|
||||||
"eslint-import-resolver-typescript": "^3.6.1",
|
"eslint-import-resolver-typescript": "^3.6.1",
|
||||||
"eslint-plugin-github": "^4.10.1",
|
"eslint-plugin-github": "^4.10.2",
|
||||||
"eslint-plugin-import": "^2.29.1",
|
"eslint-plugin-import": "^2.29.1",
|
||||||
"eslint-plugin-jest": "^27.6.3",
|
"eslint-plugin-jest": "^28.6.0",
|
||||||
"eslint-plugin-prettier": "^5.1.3",
|
"eslint-plugin-prettier": "^5.1.3",
|
||||||
"jest": "^29.7.0",
|
"jest": "^29.7.0",
|
||||||
"jest-circus": "^29.7.0",
|
"jest-circus": "^29.7.0",
|
||||||
"jest-junit": "^16.0.0",
|
"jest-junit": "^16.0.0",
|
||||||
"js-yaml": "^4.1.0",
|
"js-yaml": "^4.1.0",
|
||||||
"prettier": "^3.2.4",
|
"prettier": "^3.3.2",
|
||||||
"ts-jest": "^29.1.2",
|
"ts-jest": "^29.1.5",
|
||||||
"typescript": "^5.3.3"
|
"typescript": "^5.5.2"
|
||||||
},
|
},
|
||||||
"jest-junit": {
|
"jest-junit": {
|
||||||
"suiteName": "jest tests",
|
"suiteName": "jest tests",
|
||||||
|
|
@ -78,5 +77,8 @@
|
||||||
"suiteNameTemplate": "{filepath}",
|
"suiteNameTemplate": "{filepath}",
|
||||||
"classNameTemplate": "{classname}",
|
"classNameTemplate": "{classname}",
|
||||||
"titleTemplate": "{title}"
|
"titleTemplate": "{title}"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=20"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,344 +5,377 @@ packages:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: _fe_analyzer_shared
|
name: _fe_analyzer_shared
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "0b2f2bd91ba804e53a61d757b986f89f1f9eaed5b11e4b2f5a2468d86d6c9fc7"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "11.0.0"
|
version: "67.0.0"
|
||||||
analyzer:
|
analyzer:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: analyzer
|
name: analyzer
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "37577842a27e4338429a1cbc32679d508836510b056f1eedf0c8d20e39c1383d"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.40.4"
|
version: "6.4.1"
|
||||||
args:
|
args:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: args
|
name: args
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "7cf60b9f0cc88203c5a190b4cd62a99feea42759a7fa695010eb5de1c0b2252a"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.6.0"
|
version: "2.5.0"
|
||||||
async:
|
async:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: async
|
name: async
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.4.2"
|
version: "2.11.0"
|
||||||
boolean_selector:
|
boolean_selector:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: boolean_selector
|
name: boolean_selector
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.1.1"
|
||||||
charcode:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: charcode
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.3"
|
|
||||||
cli_util:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: cli_util
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.2.0"
|
|
||||||
collection:
|
collection:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: collection
|
name: collection
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.14.13"
|
version: "1.18.0"
|
||||||
convert:
|
convert:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: convert
|
name: convert
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "0f08b14755d163f6e2134cb58222dd25ea2a2ee8a195e53983d57c075324d592"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.1"
|
version: "3.1.1"
|
||||||
coverage:
|
coverage:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: coverage
|
name: coverage
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "8acabb8306b57a409bf4c83522065672ee13179297a6bb0cb9ead73948df7c76"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.14.1"
|
version: "1.7.2"
|
||||||
crypto:
|
crypto:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: crypto
|
name: crypto
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.1.5"
|
version: "3.0.3"
|
||||||
|
file:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: file
|
||||||
|
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "7.0.0"
|
||||||
|
frontend_server_client:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: frontend_server_client
|
||||||
|
sha256: f64a0333a82f30b0cca061bc3d143813a486dc086b574bfb233b7c1372427694
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "4.0.0"
|
||||||
glob:
|
glob:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: glob
|
name: glob
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "0e7014b3b7d4dac1ca4d6114f82bf1782ee86745b9b42a92c9289c23d8a0ab63"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "2.1.2"
|
||||||
http:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: http
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "0.12.2"
|
|
||||||
http_multi_server:
|
http_multi_server:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http_multi_server
|
name: http_multi_server
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "97486f20f9c2f7be8f514851703d0119c3596d14ea63227af6f7a481ef2b2f8b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.0"
|
version: "3.2.1"
|
||||||
http_parser:
|
http_parser:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: http_parser
|
name: http_parser
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "2aa08ce0341cc9b354a498388e30986515406668dbcc4f7c950c3e715496693b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "3.1.4"
|
version: "4.0.2"
|
||||||
io:
|
io:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: io
|
name: io
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "2ec25704aba361659e10e3e5f5d672068d332fc8ac516421d483a11e5cbd061e"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.4"
|
version: "1.0.4"
|
||||||
js:
|
js:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: js
|
name: js
|
||||||
url: "https://pub.dartlang.org"
|
sha256: c1b2e9b5ea78c45e1a0788d29606ba27dc5f71f019f32ca5140f61ef071838cf
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.6.2"
|
version: "0.7.1"
|
||||||
logging:
|
logging:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: logging
|
name: logging
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "623a88c9594aa774443aa3eb2d41807a48486b5613e67599fb4c41c0ad47c340"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.11.4"
|
version: "1.2.0"
|
||||||
matcher:
|
matcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: matcher
|
name: matcher
|
||||||
url: "https://pub.dartlang.org"
|
sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.12.9"
|
version: "0.12.16+1"
|
||||||
meta:
|
meta:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: meta
|
name: meta
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "25dfcaf170a0190f47ca6355bdd4552cb8924b430512ff0cafb8db9bd41fe33b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.3"
|
version: "1.14.0"
|
||||||
mime:
|
mime:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: mime
|
name: mime
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.7"
|
version: "1.0.5"
|
||||||
node_interop:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: node_interop
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.1"
|
|
||||||
node_io:
|
|
||||||
dependency: transitive
|
|
||||||
description:
|
|
||||||
name: node_io
|
|
||||||
url: "https://pub.dartlang.org"
|
|
||||||
source: hosted
|
|
||||||
version: "1.1.1"
|
|
||||||
node_preamble:
|
node_preamble:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: node_preamble
|
name: node_preamble
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.12"
|
version: "2.0.2"
|
||||||
package_config:
|
package_config:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: package_config
|
name: package_config
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "1c5b77ccc91e4823a5af61ee74e6b972db1ef98c2ff5a18d3161c982a55448bd"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.3"
|
version: "2.1.0"
|
||||||
path:
|
path:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: path
|
name: path
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.9.0"
|
||||||
pedantic:
|
pedantic:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: pedantic
|
name: pedantic
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "67fc27ed9639506c856c840ccce7594d0bdcd91bc8d53d6e52359449a1d50602"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.2"
|
version: "1.11.1"
|
||||||
pool:
|
pool:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pool
|
name: pool
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "20fe868b6314b322ea036ba325e6fc0711a22948856475e2c2b6306e8ab39c2a"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.0"
|
version: "1.5.1"
|
||||||
pub_semver:
|
pub_semver:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: pub_semver
|
name: pub_semver
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "40d3ab1bbd474c4c2328c91e3a7df8c6dd629b79ece4c4bd04bee496a224fb0c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.4.4"
|
version: "2.1.4"
|
||||||
shelf:
|
shelf:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf
|
name: shelf
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ad29c505aee705f41a4d8963641f91ac4cee3c8fad5947e033390a7bd8180fa4
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.9"
|
version: "1.4.1"
|
||||||
shelf_packages_handler:
|
shelf_packages_handler:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_packages_handler
|
name: shelf_packages_handler
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "3.0.2"
|
||||||
shelf_static:
|
shelf_static:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_static
|
name: shelf_static
|
||||||
url: "https://pub.dartlang.org"
|
sha256: a41d3f53c4adf0f57480578c1d61d90342cd617de7fc8077b1304643c2d85c1e
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.8"
|
version: "1.1.2"
|
||||||
shelf_web_socket:
|
shelf_web_socket:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: shelf_web_socket
|
name: shelf_web_socket
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "9ca081be41c60190ebcb4766b2486a7d50261db7bd0f5d9615f2d653637a84c1"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.3"
|
version: "1.0.4"
|
||||||
source_map_stack_trace:
|
source_map_stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_map_stack_trace
|
name: source_map_stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "84cf769ad83aa6bb61e0aa5a18e53aea683395f196a6f39c4c881fb90ed4f7ae"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.1.1"
|
||||||
source_maps:
|
source_maps:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_maps
|
name: source_maps
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.10.9"
|
version: "0.10.12"
|
||||||
source_span:
|
source_span:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: source_span
|
name: source_span
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.7.0"
|
version: "1.10.0"
|
||||||
stack_trace:
|
stack_trace:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stack_trace
|
name: stack_trace
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.9.5"
|
version: "1.11.1"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: stream_channel
|
name: stream_channel
|
||||||
url: "https://pub.dartlang.org"
|
sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.0.0"
|
version: "2.1.2"
|
||||||
string_scanner:
|
string_scanner:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: string_scanner
|
name: string_scanner
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.0.5"
|
version: "1.2.0"
|
||||||
term_glyph:
|
term_glyph:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: term_glyph
|
name: term_glyph
|
||||||
url: "https://pub.dartlang.org"
|
sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "1.2.1"
|
||||||
test:
|
test:
|
||||||
dependency: "direct dev"
|
dependency: "direct dev"
|
||||||
description:
|
description:
|
||||||
name: test
|
name: test
|
||||||
url: "https://pub.dartlang.org"
|
sha256: d87214d19fb311997d8128ec501a980f77cb240ac4e7e219accf452813ff473c
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.15.4"
|
version: "1.25.3"
|
||||||
test_api:
|
test_api:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_api
|
name: test_api
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "2419f20b0c8677b2d67c8ac4d1ac7372d862dc6c460cdbb052b40155408cd794"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.2.18"
|
version: "0.7.1"
|
||||||
test_core:
|
test_core:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: test_core
|
name: test_core
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "2236f70be1e5ab405c675e88c36935a87dad9e05a506b57dd5c0f617f5aebcb2"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.3.11+1"
|
version: "0.6.1"
|
||||||
typed_data:
|
typed_data:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: typed_data
|
name: typed_data
|
||||||
url: "https://pub.dartlang.org"
|
sha256: facc8d6582f16042dd49f2463ff1bd6e2c9ef9f3d5da3d9b087e244a7b564b3c
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.2.0"
|
version: "1.3.2"
|
||||||
vm_service:
|
vm_service:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: vm_service
|
name: vm_service
|
||||||
url: "https://pub.dartlang.org"
|
sha256: a75f83f14ad81d5fe4b3319710b90dec37da0e22612326b696c9e1b8f34bbf48
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "4.2.0"
|
version: "14.2.0"
|
||||||
watcher:
|
watcher:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: watcher
|
name: watcher
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "3d2ad6751b3c16cf07c7fca317a1413b3f26530319181b37e3b9039b84fc01d8"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.9.7+15"
|
version: "1.1.0"
|
||||||
|
web:
|
||||||
|
dependency: transitive
|
||||||
|
description:
|
||||||
|
name: web
|
||||||
|
sha256: "97da13628db363c635202ad97068d47c5b8aa555808e7a9411963c533b449b27"
|
||||||
|
url: "https://pub.dev"
|
||||||
|
source: hosted
|
||||||
|
version: "0.5.1"
|
||||||
web_socket_channel:
|
web_socket_channel:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: web_socket_channel
|
name: web_socket_channel
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "58c6666b342a38816b2e7e50ed0f1e261959630becd4c879c4f26bfa14aa5a42"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "1.1.0"
|
version: "2.4.5"
|
||||||
webkit_inspection_protocol:
|
webkit_inspection_protocol:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: webkit_inspection_protocol
|
name: webkit_inspection_protocol
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "0.7.3"
|
version: "1.2.1"
|
||||||
yaml:
|
yaml:
|
||||||
dependency: transitive
|
dependency: transitive
|
||||||
description:
|
description:
|
||||||
name: yaml
|
name: yaml
|
||||||
url: "https://pub.dartlang.org"
|
sha256: "75769501ea3489fca56601ff33454fe45507ea3bfb014161abc3b43ae25989d5"
|
||||||
|
url: "https://pub.dev"
|
||||||
source: hosted
|
source: hosted
|
||||||
version: "2.2.1"
|
version: "3.1.2"
|
||||||
sdks:
|
sdks:
|
||||||
dart: ">=2.8.1 <3.0.0"
|
dart: ">=3.3.0 <4.0.0"
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ name: darttest
|
||||||
description: A simple command-line application.
|
description: A simple command-line application.
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
sdk: '>=2.8.1 <3.0.0'
|
sdk: '>=2.12.0 <3.0.0'
|
||||||
|
|
||||||
dev_dependencies:
|
dev_dependencies:
|
||||||
pedantic: ^1.9.0
|
pedantic: ^1.9.0
|
||||||
|
|
|
||||||
64
reports/dotnet/DotnetTests.NUnitV3Tests/CalculatorTests.cs
Normal file
64
reports/dotnet/DotnetTests.NUnitV3Tests/CalculatorTests.cs
Normal file
|
|
@ -0,0 +1,64 @@
|
||||||
|
using System;
|
||||||
|
using System.Threading;
|
||||||
|
using DotnetTests.Unit;
|
||||||
|
using NUnit.Framework;
|
||||||
|
|
||||||
|
namespace DotnetTests.XUnitTests
|
||||||
|
{
|
||||||
|
public class CalculatorTests
|
||||||
|
{
|
||||||
|
private readonly Calculator _calculator = new Calculator();
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Passing_Test()
|
||||||
|
{
|
||||||
|
Assert.That(_calculator.Sum(1, 1), Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test(Description = "Some description")]
|
||||||
|
public void Passing_Test_With_Description()
|
||||||
|
{
|
||||||
|
Assert.That(2, Is.EqualTo(2));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Failing_Test()
|
||||||
|
{
|
||||||
|
Assert.That(_calculator.Sum(1, 1), Is.EqualTo(3));
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Exception_In_TargetTest()
|
||||||
|
{
|
||||||
|
_calculator.Div(1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void Exception_In_Test()
|
||||||
|
{
|
||||||
|
throw new Exception("Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Timeout(1)]
|
||||||
|
public void Timeout_Test()
|
||||||
|
{
|
||||||
|
Thread.Sleep(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("Skipped")]
|
||||||
|
public void Skipped_Test()
|
||||||
|
{
|
||||||
|
throw new Exception("Test");
|
||||||
|
}
|
||||||
|
|
||||||
|
[Theory]
|
||||||
|
[TestCase(2)]
|
||||||
|
[TestCase(3)]
|
||||||
|
public void Is_Even_Number(int i)
|
||||||
|
{
|
||||||
|
Assert.True(i % 2 == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,18 @@
|
||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netcoreapp3.1</TargetFramework>
|
||||||
|
|
||||||
|
<IsPackable>false</IsPackable>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="NUnit" Version="3.13.2" />
|
||||||
|
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<ProjectReference Include="..\DotnetTests.Unit\DotnetTests.Unit.csproj" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
||||||
|
|
@ -9,6 +9,8 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tests", "Tests", "{BCAC3B31
|
||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotnetTests.XUnitTests", "DotnetTests.XUnitTests\DotnetTests.XUnitTests.csproj", "{F8607EDB-D25D-47AA-8132-38ACA242E845}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "DotnetTests.XUnitTests", "DotnetTests.XUnitTests\DotnetTests.XUnitTests.csproj", "{F8607EDB-D25D-47AA-8132-38ACA242E845}"
|
||||||
EndProject
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotnetTests.NUnitV3Tests", "DotnetTests.NUnitV3Tests\DotnetTests.NUnitV3Tests.csproj", "{81023ED7-56CB-47E9-86C5-9125A0873C55}"
|
||||||
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
|
|
@ -23,12 +25,17 @@ Global
|
||||||
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Release|Any CPU.Build.0 = Release|Any CPU
|
{F8607EDB-D25D-47AA-8132-38ACA242E845}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{81023ED7-56CB-47E9-86C5-9125A0873C55}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{81023ED7-56CB-47E9-86C5-9125A0873C55}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{81023ED7-56CB-47E9-86C5-9125A0873C55}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{81023ED7-56CB-47E9-86C5-9125A0873C55}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(NestedProjects) = preSolution
|
GlobalSection(NestedProjects) = preSolution
|
||||||
{F8607EDB-D25D-47AA-8132-38ACA242E845} = {BCAC3B31-ADB1-4221-9D5B-182EE868648C}
|
{F8607EDB-D25D-47AA-8132-38ACA242E845} = {BCAC3B31-ADB1-4221-9D5B-182EE868648C}
|
||||||
|
{81023ED7-56CB-47E9-86C5-9125A0873C55} = {BCAC3B31-ADB1-4221-9D5B-182EE868648C}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
SolutionGuid = {6ED5543C-74AA-4B21-8050-943550F3F66E}
|
SolutionGuid = {6ED5543C-74AA-4B21-8050-943550F3F66E}
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,12 @@ import {getAnnotations} from './report/get-annotations'
|
||||||
import {getReport} from './report/get-report'
|
import {getReport} from './report/get-report'
|
||||||
|
|
||||||
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
|
import {DartJsonParser} from './parsers/dart-json/dart-json-parser'
|
||||||
|
import {DotnetNunitParser} from './parsers/dotnet-nunit/dotnet-nunit-parser'
|
||||||
import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser'
|
import {DotnetTrxParser} from './parsers/dotnet-trx/dotnet-trx-parser'
|
||||||
import {JavaJunitParser} from './parsers/java-junit/java-junit-parser'
|
import {JavaJunitParser} from './parsers/java-junit/java-junit-parser'
|
||||||
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
|
import {JestJunitParser} from './parsers/jest-junit/jest-junit-parser'
|
||||||
import {MochaJsonParser} from './parsers/mocha-json/mocha-json-parser'
|
import {MochaJsonParser} from './parsers/mocha-json/mocha-json-parser'
|
||||||
|
import {RspecJsonParser} from './parsers/rspec-json/rspec-json-parser'
|
||||||
import {SwiftXunitParser} from './parsers/swift-xunit/swift-xunit-parser'
|
import {SwiftXunitParser} from './parsers/swift-xunit/swift-xunit-parser'
|
||||||
|
|
||||||
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
|
import {normalizeDirPath, normalizeFilePath} from './utils/path-utils'
|
||||||
|
|
@ -226,6 +228,8 @@ class TestReporter {
|
||||||
switch (reporter) {
|
switch (reporter) {
|
||||||
case 'dart-json':
|
case 'dart-json':
|
||||||
return new DartJsonParser(options, 'dart')
|
return new DartJsonParser(options, 'dart')
|
||||||
|
case 'dotnet-nunit':
|
||||||
|
return new DotnetNunitParser(options)
|
||||||
case 'dotnet-trx':
|
case 'dotnet-trx':
|
||||||
return new DotnetTrxParser(options)
|
return new DotnetTrxParser(options)
|
||||||
case 'flutter-json':
|
case 'flutter-json':
|
||||||
|
|
@ -236,6 +240,8 @@ class TestReporter {
|
||||||
return new JestJunitParser(options)
|
return new JestJunitParser(options)
|
||||||
case 'mocha-json':
|
case 'mocha-json':
|
||||||
return new MochaJsonParser(options)
|
return new MochaJsonParser(options)
|
||||||
|
case 'rspec-json':
|
||||||
|
return new RspecJsonParser(options)
|
||||||
case 'swift-xunit':
|
case 'swift-xunit':
|
||||||
return new SwiftXunitParser(options)
|
return new SwiftXunitParser(options)
|
||||||
default:
|
default:
|
||||||
|
|
|
||||||
|
|
@ -123,7 +123,7 @@ export class DartJsonParser implements TestParser {
|
||||||
const group = suite.groups[evt.test.groupIDs[evt.test.groupIDs.length - 1]]
|
const group = suite.groups[evt.test.groupIDs[evt.test.groupIDs.length - 1]]
|
||||||
group.tests.push(test)
|
group.tests.push(test)
|
||||||
tests[evt.test.id] = test
|
tests[evt.test.id] = test
|
||||||
} else if (isTestDoneEvent(evt) && !evt.hidden && tests[evt.testID]) {
|
} else if (isTestDoneEvent(evt) && tests[evt.testID]) {
|
||||||
tests[evt.testID].testDone = evt
|
tests[evt.testID].testDone = evt
|
||||||
} else if (isErrorEvent(evt) && tests[evt.testID]) {
|
} else if (isErrorEvent(evt) && tests[evt.testID]) {
|
||||||
tests[evt.testID].error = evt
|
tests[evt.testID].error = evt
|
||||||
|
|
@ -152,14 +152,16 @@ export class DartJsonParser implements TestParser {
|
||||||
|
|
||||||
return groups.map(group => {
|
return groups.map(group => {
|
||||||
group.tests.sort((a, b) => (a.testStart.test.line ?? 0) - (b.testStart.test.line ?? 0))
|
group.tests.sort((a, b) => (a.testStart.test.line ?? 0) - (b.testStart.test.line ?? 0))
|
||||||
const tests = group.tests.map(tc => {
|
const tests = group.tests
|
||||||
const error = this.getError(suite, tc)
|
.filter(tc => !tc.testDone?.hidden)
|
||||||
const testName =
|
.map(tc => {
|
||||||
group.group.name !== undefined && tc.testStart.test.name.startsWith(group.group.name)
|
const error = this.getError(suite, tc)
|
||||||
? tc.testStart.test.name.slice(group.group.name.length).trim()
|
const testName =
|
||||||
: tc.testStart.test.name.trim()
|
group.group.name !== undefined && tc.testStart.test.name.startsWith(group.group.name)
|
||||||
return new TestCaseResult(testName, tc.result, tc.time, error)
|
? tc.testStart.test.name.slice(group.group.name.length).trim()
|
||||||
})
|
: tc.testStart.test.name.trim()
|
||||||
|
return new TestCaseResult(testName, tc.result, tc.time, error)
|
||||||
|
})
|
||||||
return new TestGroupResult(group.group.name, tests)
|
return new TestGroupResult(group.group.name, tests)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
151
src/parsers/dotnet-nunit/dotnet-nunit-parser.ts
Normal file
151
src/parsers/dotnet-nunit/dotnet-nunit-parser.ts
Normal file
|
|
@ -0,0 +1,151 @@
|
||||||
|
import {ParseOptions, TestParser} from '../../test-parser'
|
||||||
|
import {parseStringPromise} from 'xml2js'
|
||||||
|
|
||||||
|
import {NunitReport, TestCase, TestSuite} from './dotnet-nunit-types'
|
||||||
|
import {getExceptionSource} from '../../utils/node-utils'
|
||||||
|
import {getBasePath, normalizeFilePath} from '../../utils/path-utils'
|
||||||
|
|
||||||
|
import {
|
||||||
|
TestExecutionResult,
|
||||||
|
TestRunResult,
|
||||||
|
TestSuiteResult,
|
||||||
|
TestGroupResult,
|
||||||
|
TestCaseResult,
|
||||||
|
TestCaseError
|
||||||
|
} from '../../test-results'
|
||||||
|
|
||||||
|
export class DotnetNunitParser implements TestParser {
|
||||||
|
assumedWorkDir: string | undefined
|
||||||
|
|
||||||
|
constructor(readonly options: ParseOptions) {}
|
||||||
|
|
||||||
|
async parse(path: string, content: string): Promise<TestRunResult> {
|
||||||
|
const ju = await this.getNunitReport(path, content)
|
||||||
|
return this.getTestRunResult(path, ju)
|
||||||
|
}
|
||||||
|
|
||||||
|
private async getNunitReport(path: string, content: string): Promise<NunitReport> {
|
||||||
|
try {
|
||||||
|
return (await parseStringPromise(content)) as NunitReport
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(`Invalid XML at ${path}\n\n${e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTestRunResult(path: string, nunit: NunitReport): TestRunResult {
|
||||||
|
const suites: TestSuiteResult[] = []
|
||||||
|
const time = parseFloat(nunit['test-run'].$.duration) * 1000
|
||||||
|
|
||||||
|
this.populateTestCasesRecursive(suites, [], nunit['test-run']['test-suite'])
|
||||||
|
|
||||||
|
return new TestRunResult(path, suites, time)
|
||||||
|
}
|
||||||
|
|
||||||
|
private populateTestCasesRecursive(
|
||||||
|
result: TestSuiteResult[],
|
||||||
|
suitePath: TestSuite[],
|
||||||
|
testSuites: TestSuite[] | undefined
|
||||||
|
): void {
|
||||||
|
if (testSuites === undefined) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const suite of testSuites) {
|
||||||
|
suitePath.push(suite)
|
||||||
|
|
||||||
|
this.populateTestCasesRecursive(result, suitePath, suite['test-suite'])
|
||||||
|
|
||||||
|
const testcases = suite['test-case']
|
||||||
|
if (testcases !== undefined) {
|
||||||
|
for (const testcase of testcases) {
|
||||||
|
this.addTestCase(result, suitePath, testcase)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
suitePath.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private addTestCase(result: TestSuiteResult[], suitePath: TestSuite[], testCase: TestCase): void {
|
||||||
|
// The last suite in the suite path is the "group".
|
||||||
|
// The rest are concatenated together to form the "suite".
|
||||||
|
// But ignore "Theory" suites.
|
||||||
|
const suitesWithoutTheories = suitePath.filter(suite => suite.$.type !== 'Theory')
|
||||||
|
const suiteName = suitesWithoutTheories
|
||||||
|
.slice(0, suitesWithoutTheories.length - 1)
|
||||||
|
.map(suite => suite.$.name)
|
||||||
|
.join('.')
|
||||||
|
const groupName = suitesWithoutTheories[suitesWithoutTheories.length - 1].$.name
|
||||||
|
|
||||||
|
let existingSuite = result.find(existingSuite => existingSuite.name === suiteName)
|
||||||
|
if (existingSuite === undefined) {
|
||||||
|
existingSuite = new TestSuiteResult(suiteName, [])
|
||||||
|
result.push(existingSuite)
|
||||||
|
}
|
||||||
|
|
||||||
|
let existingGroup = existingSuite.groups.find(existingGroup => existingGroup.name === groupName)
|
||||||
|
if (existingGroup === undefined) {
|
||||||
|
existingGroup = new TestGroupResult(groupName, [])
|
||||||
|
existingSuite.groups.push(existingGroup)
|
||||||
|
}
|
||||||
|
|
||||||
|
existingGroup.tests.push(
|
||||||
|
new TestCaseResult(
|
||||||
|
testCase.$.name,
|
||||||
|
this.getTestExecutionResult(testCase),
|
||||||
|
parseFloat(testCase.$.duration) * 1000,
|
||||||
|
this.getTestCaseError(testCase)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTestExecutionResult(test: TestCase): TestExecutionResult {
|
||||||
|
if (test.$.result === 'Failed' || test.failure) return 'failed'
|
||||||
|
if (test.$.result === 'Skipped') return 'skipped'
|
||||||
|
return 'success'
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTestCaseError(tc: TestCase): TestCaseError | undefined {
|
||||||
|
if (!this.options.parseErrors || !tc.failure || tc.failure.length === 0) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
const details = tc.failure[0]
|
||||||
|
let path
|
||||||
|
let line
|
||||||
|
|
||||||
|
if (details['stack-trace'] !== undefined && details['stack-trace'].length > 0) {
|
||||||
|
const src = getExceptionSource(details['stack-trace'][0], this.options.trackedFiles, file =>
|
||||||
|
this.getRelativePath(file)
|
||||||
|
)
|
||||||
|
if (src) {
|
||||||
|
path = src.path
|
||||||
|
line = src.line
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
path,
|
||||||
|
line,
|
||||||
|
message: details.message && details.message.length > 0 ? details.message[0] : '',
|
||||||
|
details: details['stack-trace'] && details['stack-trace'].length > 0 ? details['stack-trace'][0] : ''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getRelativePath(path: string): string {
|
||||||
|
path = normalizeFilePath(path)
|
||||||
|
const workDir = this.getWorkDir(path)
|
||||||
|
if (workDir !== undefined && path.startsWith(workDir)) {
|
||||||
|
path = path.substr(workDir.length)
|
||||||
|
}
|
||||||
|
return path
|
||||||
|
}
|
||||||
|
|
||||||
|
private getWorkDir(path: string): string | undefined {
|
||||||
|
return (
|
||||||
|
this.options.workDir ??
|
||||||
|
this.assumedWorkDir ??
|
||||||
|
(this.assumedWorkDir = getBasePath(path, this.options.trackedFiles))
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
57
src/parsers/dotnet-nunit/dotnet-nunit-types.ts
Normal file
57
src/parsers/dotnet-nunit/dotnet-nunit-types.ts
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
export interface NunitReport {
|
||||||
|
'test-run': TestRun
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TestRun {
|
||||||
|
$: {
|
||||||
|
id: string
|
||||||
|
runstate: string
|
||||||
|
testcasecount: string
|
||||||
|
result: string
|
||||||
|
total: string
|
||||||
|
passed: string
|
||||||
|
failed: string
|
||||||
|
inconclusive: string
|
||||||
|
skipped: string
|
||||||
|
asserts: string
|
||||||
|
'engine-version': string
|
||||||
|
'clr-version': string
|
||||||
|
'start-time': string
|
||||||
|
'end-time': string
|
||||||
|
duration: string
|
||||||
|
}
|
||||||
|
'test-suite'?: TestSuite[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TestSuite {
|
||||||
|
$: {
|
||||||
|
name: string
|
||||||
|
type: string
|
||||||
|
}
|
||||||
|
'test-case'?: TestCase[]
|
||||||
|
'test-suite'?: TestSuite[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TestCase {
|
||||||
|
$: {
|
||||||
|
id: string
|
||||||
|
name: string
|
||||||
|
fullname: string
|
||||||
|
methodname: string
|
||||||
|
classname: string
|
||||||
|
runstate: string
|
||||||
|
seed: string
|
||||||
|
result: string
|
||||||
|
label: string
|
||||||
|
'start-time': string
|
||||||
|
'end-time': string
|
||||||
|
duration: string
|
||||||
|
asserts: string
|
||||||
|
}
|
||||||
|
failure?: TestFailure[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface TestFailure {
|
||||||
|
message?: string[]
|
||||||
|
'stack-trace'?: string[]
|
||||||
|
}
|
||||||
|
|
@ -137,11 +137,18 @@ export class JavaJunitParser implements TestParser {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let message
|
||||||
|
if (typeof failure === 'object') {
|
||||||
|
message = failure.$.message
|
||||||
|
if (failure.$?.type) {
|
||||||
|
message = failure.$.type + ': ' + message
|
||||||
|
}
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
path: filePath,
|
path: filePath,
|
||||||
line,
|
line,
|
||||||
details,
|
details,
|
||||||
message: typeof failure === 'object' ? failure.message : undefined
|
message
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,8 @@ export interface TestCase {
|
||||||
|
|
||||||
export interface Failure {
|
export interface Failure {
|
||||||
_: string
|
_: string
|
||||||
type: string
|
$: {
|
||||||
message: string
|
type?: string
|
||||||
|
message: string
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
112
src/parsers/rspec-json/rspec-json-parser.ts
Normal file
112
src/parsers/rspec-json/rspec-json-parser.ts
Normal file
|
|
@ -0,0 +1,112 @@
|
||||||
|
import {ParseOptions, TestParser} from '../../test-parser'
|
||||||
|
import {
|
||||||
|
TestCaseError,
|
||||||
|
TestCaseResult,
|
||||||
|
TestExecutionResult,
|
||||||
|
TestGroupResult,
|
||||||
|
TestRunResult,
|
||||||
|
TestSuiteResult
|
||||||
|
} from '../../test-results'
|
||||||
|
import {RspecJson, RspecExample} from './rspec-json-types'
|
||||||
|
|
||||||
|
export class RspecJsonParser implements TestParser {
|
||||||
|
assumedWorkDir: string | undefined
|
||||||
|
|
||||||
|
constructor(readonly options: ParseOptions) {}
|
||||||
|
|
||||||
|
async parse(path: string, content: string): Promise<TestRunResult> {
|
||||||
|
const mocha = this.getRspecJson(path, content)
|
||||||
|
const result = this.getTestRunResult(path, mocha)
|
||||||
|
result.sort(true)
|
||||||
|
return Promise.resolve(result)
|
||||||
|
}
|
||||||
|
|
||||||
|
private getRspecJson(path: string, content: string): RspecJson {
|
||||||
|
try {
|
||||||
|
return JSON.parse(content)
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error(`Invalid JSON at ${path}\n\n${e}`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTestRunResult(resultsPath: string, rspec: RspecJson): TestRunResult {
|
||||||
|
const suitesMap: {[path: string]: TestSuiteResult} = {}
|
||||||
|
|
||||||
|
const getSuite = (test: RspecExample): TestSuiteResult => {
|
||||||
|
const path = test.file_path
|
||||||
|
return suitesMap[path] ?? (suitesMap[path] = new TestSuiteResult(path, []))
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const test of rspec.examples) {
|
||||||
|
const suite = getSuite(test)
|
||||||
|
if (test.status === 'failed') {
|
||||||
|
this.processTest(suite, test, 'failed')
|
||||||
|
} else if (test.status === 'passed') {
|
||||||
|
this.processTest(suite, test, 'success')
|
||||||
|
} else if (test.status === 'pending') {
|
||||||
|
this.processTest(suite, test, 'skipped')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const suites = Object.values(suitesMap)
|
||||||
|
return new TestRunResult(resultsPath, suites, rspec.summary.duration)
|
||||||
|
}
|
||||||
|
|
||||||
|
private processTest(suite: TestSuiteResult, test: RspecExample, result: TestExecutionResult): void {
|
||||||
|
const groupName =
|
||||||
|
test.full_description !== test.description
|
||||||
|
? test.full_description.substr(0, test.full_description.length - test.description.length).trimEnd()
|
||||||
|
: null
|
||||||
|
|
||||||
|
let group = suite.groups.find(grp => grp.name === groupName)
|
||||||
|
if (group === undefined) {
|
||||||
|
group = new TestGroupResult(groupName, [])
|
||||||
|
suite.groups.push(group)
|
||||||
|
}
|
||||||
|
|
||||||
|
const error = this.getTestCaseError(test)
|
||||||
|
const testCase = new TestCaseResult(test.full_description, result, test.run_time ?? 0, error)
|
||||||
|
group.tests.push(testCase)
|
||||||
|
}
|
||||||
|
|
||||||
|
private getTestCaseError(test: RspecExample): TestCaseError | undefined {
|
||||||
|
const backtrace = test.exception?.backtrace
|
||||||
|
const message = test.exception?.message
|
||||||
|
if (backtrace === undefined) {
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
|
||||||
|
let path
|
||||||
|
let line
|
||||||
|
const details = backtrace.join('\n')
|
||||||
|
|
||||||
|
const src = this.getExceptionSource(backtrace)
|
||||||
|
if (src) {
|
||||||
|
path = src.path
|
||||||
|
line = src.line
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
path,
|
||||||
|
line,
|
||||||
|
message,
|
||||||
|
details
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private getExceptionSource(backtrace: string[]): {path: string; line: number} | undefined {
|
||||||
|
const re = /^(.*?):(\d+):/
|
||||||
|
|
||||||
|
for (const str of backtrace) {
|
||||||
|
const match = str.match(re)
|
||||||
|
if (match !== null) {
|
||||||
|
const [_, path, lineStr] = match
|
||||||
|
if (path.startsWith('./')) {
|
||||||
|
const line = parseInt(lineStr)
|
||||||
|
return {path, line}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return undefined
|
||||||
|
}
|
||||||
|
}
|
||||||
34
src/parsers/rspec-json/rspec-json-types.ts
Normal file
34
src/parsers/rspec-json/rspec-json-types.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
export interface RspecJson {
|
||||||
|
version: number
|
||||||
|
examples: RspecExample[]
|
||||||
|
summary: RspecSummary
|
||||||
|
summary_line: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RspecExample {
|
||||||
|
id: string
|
||||||
|
description: string
|
||||||
|
full_description: string
|
||||||
|
status: TestStatus
|
||||||
|
file_path: string
|
||||||
|
line_number: number
|
||||||
|
run_time: number
|
||||||
|
pending_message: string | null
|
||||||
|
exception?: RspecException
|
||||||
|
}
|
||||||
|
|
||||||
|
type TestStatus = 'passed' | 'failed' | 'pending'
|
||||||
|
|
||||||
|
export interface RspecException {
|
||||||
|
class: string
|
||||||
|
message: string
|
||||||
|
backtrace: string[]
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface RspecSummary {
|
||||||
|
duration: number
|
||||||
|
example_count: number
|
||||||
|
failure_count: number
|
||||||
|
pending_count: number
|
||||||
|
errors_outside_of_examples_count: number
|
||||||
|
}
|
||||||
|
|
@ -50,33 +50,17 @@ export async function downloadArtifact(
|
||||||
const headers = {
|
const headers = {
|
||||||
Authorization: `Bearer ${token}`
|
Authorization: `Bearer ${token}`
|
||||||
}
|
}
|
||||||
const resp = await got(req.url, {
|
|
||||||
headers,
|
|
||||||
followRedirect: false
|
|
||||||
})
|
|
||||||
|
|
||||||
core.info(`Fetch artifact URL: ${resp.statusCode} ${resp.statusMessage}`)
|
const downloadStream = got.stream(req.url, {headers})
|
||||||
if (resp.statusCode !== 302) {
|
|
||||||
throw new Error('Fetch artifact URL failed: received unexpected status code')
|
|
||||||
}
|
|
||||||
|
|
||||||
const url = resp.headers.location
|
|
||||||
if (url === undefined) {
|
|
||||||
const receivedHeaders = Object.keys(resp.headers)
|
|
||||||
core.info(`Received headers: ${receivedHeaders.join(', ')}`)
|
|
||||||
throw new Error('Location header was not found in API response')
|
|
||||||
}
|
|
||||||
if (typeof url !== 'string') {
|
|
||||||
throw new Error(`Location header has unexpected value: ${url}`)
|
|
||||||
}
|
|
||||||
|
|
||||||
const downloadStream = got.stream(url, {headers})
|
|
||||||
const fileWriterStream = createWriteStream(fileName)
|
const fileWriterStream = createWriteStream(fileName)
|
||||||
|
|
||||||
core.info(`Downloading ${url}`)
|
downloadStream.on('redirect', response => {
|
||||||
|
core.info(`Downloading ${response.headers.location}`)
|
||||||
|
})
|
||||||
downloadStream.on('downloadProgress', ({transferred}) => {
|
downloadStream.on('downloadProgress', ({transferred}) => {
|
||||||
core.info(`Progress: ${transferred} B`)
|
core.info(`Progress: ${transferred} B`)
|
||||||
})
|
})
|
||||||
|
|
||||||
await asyncStream(downloadStream, fileWriterStream)
|
await asyncStream(downloadStream, fileWriterStream)
|
||||||
} finally {
|
} finally {
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,16 @@
|
||||||
{
|
{
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
"lib": ["es2023"],
|
||||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
"module": "node16",
|
||||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
"target": "es2022",
|
||||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
|
||||||
"strict": true, /* Enable all strict type-checking options. */
|
"strict": true,
|
||||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
"esModuleInterop": true,
|
||||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
"skipLibCheck": true,
|
||||||
|
"moduleResolution": "node16",
|
||||||
|
|
||||||
|
"outDir": "./lib",
|
||||||
|
"rootDir": "./src",
|
||||||
},
|
},
|
||||||
"exclude": ["node_modules", "**/*.test.ts"]
|
"exclude": ["node_modules", "**/*.test.ts"]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue