Undo trx parsing changes temporarily

This commit is contained in:
Ray Xu 2024-05-29 16:58:25 -07:00
parent 775c900089
commit 574868ab61
7 changed files with 13 additions and 31 deletions

View file

@ -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|
|:---|---:|---:|---:|---:|

View file

@ -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|
|:---|---:|---:|---:|---:|

View file

@ -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|
|:---|---:|---:|---:|---:|

View file

@ -2,7 +2,7 @@
exports[`dotnet-trx tests matches report snapshot 1`] = `
TestRunResult {
"path": "DotnetTests.XUnitTests",
"path": "fixtures/dotnet-trx.trx",
"suites": [
TestSuiteResult {
"groups": [
@ -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": [
@ -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": [

11
dist/index.js generated vendored
View file

@ -751,9 +751,8 @@ const path_utils_1 = __nccwpck_require__(4070);
const parse_utils_1 = __nccwpck_require__(7811);
const test_results_1 = __nccwpck_require__(2768);
class TestClass {
constructor(name, assemblyName) {
constructor(name) {
this.name = name;
this.assemblyName = assemblyName;
this.tests = [];
}
}
@ -815,12 +814,9 @@ class DotnetTrxParser {
const testClasses = {};
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);
@ -847,9 +843,6 @@ class DotnetTrxParser {
const group = new test_results_1.TestGroupResult(null, tests);
return new test_results_1.TestSuiteResult(testClass.name, [group]);
});
if (testClasses.length > 0) {
return new test_results_1.TestRunResult(testClasses[0].assemblyName, suites, totalTime);
}
return new test_results_1.TestRunResult(path, suites, totalTime);
}
getErrorInfo(testResult) {

View file

@ -16,10 +16,7 @@ import {
} from '../../test-results'
class TestClass {
constructor(
readonly name: string,
readonly assemblyName: string
) {}
constructor(readonly name: string) {}
readonly tests: Test[] = []
}
@ -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)
@ -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)
}

View file

@ -30,7 +30,6 @@ export interface UnitTest {
export interface TestMethod {
$: {
codeBase: string
className: string
name: string
}