Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose timestamp for a test suite from JUnit #85

Open
tovbinm opened this issue Aug 17, 2024 · 0 comments
Open

Expose timestamp for a test suite from JUnit #85

tovbinm opened this issue Aug 17, 2024 · 0 comments
Labels
enhancement New feature or request

Comments

@tovbinm
Copy link

tovbinm commented Aug 17, 2024

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch [email protected] for the project I'm working on.

This change allows exposing timestamp for a test suite from JUnit.

Here is the diff that solved my problem:

diff --git a/node_modules/test-results-parser/src/index.d.ts b/node_modules/test-results-parser/src/index.d.ts
index f128d44..89c8ab5 100644
--- a/node_modules/test-results-parser/src/index.d.ts
+++ b/node_modules/test-results-parser/src/index.d.ts
@@ -22,6 +22,7 @@ export interface ITestSuite {
   errors: number;
   skipped: number;
   duration: number;
+  timestamp: string;
   status: string;
   tags: string[];
   metadata: object;
diff --git a/node_modules/test-results-parser/src/models/TestSuite.d.ts b/node_modules/test-results-parser/src/models/TestSuite.d.ts
index 2a7628a..6bd9389 100644
--- a/node_modules/test-results-parser/src/models/TestSuite.d.ts
+++ b/node_modules/test-results-parser/src/models/TestSuite.d.ts
@@ -8,6 +8,7 @@ declare class TestSuite {
   errors: number;
   skipped: number;
   duration: number;
+  timestamp: string;
   status: string;
   tags: string[];
   metadata: object;
diff --git a/node_modules/test-results-parser/src/models/TestSuite.js b/node_modules/test-results-parser/src/models/TestSuite.js
index 776c56f..182be8e 100644
--- a/node_modules/test-results-parser/src/models/TestSuite.js
+++ b/node_modules/test-results-parser/src/models/TestSuite.js
@@ -9,6 +9,7 @@ class TestSuite {
     this.errors = 0;
     this.skipped = 0;
     this.duration = 0;
+    this.timestamp = '';
     this.status = 'NA';
     this.tags = [];
     this.metadata = {};
diff --git a/node_modules/test-results-parser/src/parsers/junit.js b/node_modules/test-results-parser/src/parsers/junit.js
index 073d7a6..48f54a8 100644
--- a/node_modules/test-results-parser/src/parsers/junit.js
+++ b/node_modules/test-results-parser/src/parsers/junit.js
@@ -62,6 +62,7 @@ function getTestSuite(rawSuite) {
   suite.total = suite.total - suite.skipped;
   suite.passed = suite.total - suite.failed - suite.errors;
   suite.duration = rawSuite["@_time"] * 1000;
+  suite.timestamp = rawSuite["@_timestamp"];
   suite.status = suite.total === suite.passed ? 'PASS' : 'FAIL';
   setMetaData(rawSuite, suite);
   const raw_test_cases = rawSuite.testcase;

This issue body was partially generated by patch-package.

@ASaiAnudeep ASaiAnudeep added the enhancement New feature or request label Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants