Skip to content

Commit

Permalink
Undo trx parsing changes temporarily
Browse files Browse the repository at this point in the history
  • Loading branch information
Ray Xu committed May 30, 2024
1 parent 775c900 commit 574868a
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 31 deletions.
4 changes: 2 additions & 2 deletions __tests__/__outputs__/dotnet-trx.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
![Tests failed](https://img.shields.io/badge/tests-5%20passed%2C%205%20failed%2C%201%20skipped-critical)
|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|DotnetTests.XUnitTests|5:white_check_mark:|5:x:|1:warning:|1s|
## :x: <a id="user-content-r0" href="#r0">DotnetTests.XUnitTests</a>
|fixtures/dotnet-trx.trx|5:white_check_mark:|5:x:|1:warning:|1s|
## :x: <a id="user-content-r0" href="#r0">fixtures/dotnet-trx.trx</a>
**11** tests were completed in **1s** with **5** passed, **5** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__outputs__/fluent-validation-test-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|FluentValidation.Tests|803:white_check_mark:||1:warning:|4s|
## :white_check_mark: <a id="user-content-r0" href="#r0">FluentValidation.Tests</a>
|fixtures/external/FluentValidation.Tests.trx|803:white_check_mark:||1:warning:|4s|
## :white_check_mark: <a id="user-content-r0" href="#r0">fixtures/external/FluentValidation.Tests.trx</a>
**804** tests were completed in **4s** with **803** passed, **0** failed and **1** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__outputs__/silent-notes-test-results.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

|Report|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
|VanillaCloudStorageClientTest|67:white_check_mark:||12:warning:|1s|
## :white_check_mark: <a id="user-content-r0" href="#r0">VanillaCloudStorageClientTest</a>
|fixtures/external/SilentNotes.trx|67:white_check_mark:||12:warning:|1s|
## :white_check_mark: <a id="user-content-r0" href="#r0">fixtures/external/SilentNotes.trx</a>
**79** tests were completed in **1s** with **67** passed, **0** failed and **12** skipped.
|Test suite|Passed|Failed|Skipped|Time|
|:---|---:|---:|---:|---:|
Expand Down
6 changes: 3 additions & 3 deletions __tests__/__snapshots__/dotnet-trx.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

exports[`dotnet-trx tests matches report snapshot 1`] = `
TestRunResult {
"path": "DotnetTests.XUnitTests",
"path": "fixtures/dotnet-trx.trx",
"suites": [
TestSuiteResult {
"groups": [
Expand Down Expand Up @@ -131,7 +131,7 @@ Actual: False",

exports[`dotnet-trx tests report from FluentValidation test results matches snapshot 1`] = `
TestRunResult {
"path": "FluentValidation.Tests",
"path": "fixtures/external/FluentValidation.Tests.trx",
"suites": [
TestSuiteResult {
"groups": [
Expand Down Expand Up @@ -5646,7 +5646,7 @@ TestRunResult {

exports[`dotnet-trx tests report from SilentNotes test results matches snapshot 1`] = `
TestRunResult {
"path": "VanillaCloudStorageClientTest",
"path": "fixtures/external/SilentNotes.trx",
"suites": [
TestSuiteResult {
"groups": [
Expand Down
11 changes: 2 additions & 9 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 2 additions & 12 deletions src/parsers/dotnet-trx/dotnet-trx-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,7 @@ import {
} from '../../test-results'

class TestClass {
constructor(
readonly name: string,
readonly assemblyName: string
) {}
constructor(readonly name: string) {}
readonly tests: Test[] = []
}

Expand Down Expand Up @@ -84,12 +81,9 @@ export class DotnetTrxParser implements TestParser {
const testClasses: {[name: string]: TestClass} = {}
for (const r of unitTestsResults) {
const className = r.test.TestMethod[0].$.className
const codeBase = r.test.TestMethod[0].$.codeBase
const pathSegments = codeBase.replace(/\\/g, '/').split('/')
const assemblyName = pathSegments[pathSegments.length - 1].replace('.dll', '')
let tc = testClasses[className]
if (tc === undefined) {
tc = new TestClass(className, assemblyName)
tc = new TestClass(className)
testClasses[tc.name] = tc
}
const error = this.getErrorInfo(r.result)
Expand Down Expand Up @@ -123,10 +117,6 @@ export class DotnetTrxParser implements TestParser {
return new TestSuiteResult(testClass.name, [group])
})

if (testClasses.length > 0) {
return new TestRunResult(testClasses[0].assemblyName, suites, totalTime)
}

return new TestRunResult(path, suites, totalTime)
}

Expand Down
1 change: 0 additions & 1 deletion src/parsers/dotnet-trx/dotnet-trx-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export interface UnitTest {

export interface TestMethod {
$: {
codeBase: string
className: string
name: string
}
Expand Down

0 comments on commit 574868a

Please sign in to comment.