Skip to content

Commit

Permalink
Elapsed time in minutes (#63)
Browse files Browse the repository at this point in the history
* show time in minutes

* 1.1.26

* build

* bump packages
  • Loading branch information
MishaKav committed Apr 22, 2022
1 parent ce20734 commit 8856b4a
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 31 deletions.
8 changes: 6 additions & 2 deletions dist/index.js
Expand Up @@ -15113,9 +15113,11 @@ const getNotSuccessTest = (options) => {
// convert summary from junitxml to md
const toMarkdown = (summary, options) => {
const { errors, failures, skipped, tests, time } = summary;
const displayTime =
time > 60 ? `${(time / 60) | 0}m ${time % 60 | 0}s` : `${time}s`;
const table = `| Tests | Skipped | Failures | Errors | Time |
| ----- | ------- | -------- | -------- | ------------------ |
| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${time}s :stopwatch: |
| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${displayTime} :stopwatch: |
`;

if (options.xmlTitle) {
Expand Down Expand Up @@ -15219,7 +15221,9 @@ const getMultipleReport = (options) => {

if (hasXmlReports && summary) {
const { errors, failures, skipped, tests, time } = summary;
table += `| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${time}s :stopwatch: |
const displayTime =
time > 60 ? `${(time / 60) | 0}m ${time % 60 | 0}s` : `${time}s`;
table += `| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${displayTime} :stopwatch: |
`;
} else {
table += `
Expand Down
49 changes: 26 additions & 23 deletions package-lock.json

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

8 changes: 4 additions & 4 deletions package.json
@@ -1,6 +1,6 @@
{
"name": "pytest-coverage-comment",
"version": "1.1.25",
"version": "1.1.26",
"description": "Comments a pull request with the pytest code coverage badge, full report and tests summary",
"author": "Misha Kav",
"license": "MIT",
Expand Down Expand Up @@ -28,9 +28,9 @@
"xml2js": "^0.4.23"
},
"devDependencies": {
"@vercel/ncc": "^0.33.3",
"eslint": "^8.11.0",
"prettier": "^2.5.1"
"@vercel/ncc": "^0.33.4",
"eslint": "^8.13.0",
"prettier": "^2.6.2"
},
"prettier": {
"semi": true,
Expand Down
4 changes: 3 additions & 1 deletion src/junitXml.js
Expand Up @@ -116,9 +116,11 @@ const getNotSuccessTest = (options) => {
// convert summary from junitxml to md
const toMarkdown = (summary, options) => {
const { errors, failures, skipped, tests, time } = summary;
const displayTime =
time > 60 ? `${(time / 60) | 0}m ${time % 60 | 0}s` : `${time}s`;
const table = `| Tests | Skipped | Failures | Errors | Time |
| ----- | ------- | -------- | -------- | ------------------ |
| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${time}s :stopwatch: |
| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${displayTime} :stopwatch: |
`;

if (options.xmlTitle) {
Expand Down
4 changes: 3 additions & 1 deletion src/multiFiles.js
Expand Up @@ -83,7 +83,9 @@ const getMultipleReport = (options) => {

if (hasXmlReports && summary) {
const { errors, failures, skipped, tests, time } = summary;
table += `| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${time}s :stopwatch: |
const displayTime =
time > 60 ? `${(time / 60) | 0}m ${time % 60 | 0}s` : `${time}s`;
table += `| ${tests} | ${skipped} :zzz: | ${failures} :x: | ${errors} :fire: | ${displayTime} :stopwatch: |
`;
} else {
table += `
Expand Down

0 comments on commit 8856b4a

Please sign in to comment.