From 15eb26417c4fd3f5a55e4bfca8e5e7c1f24270ac Mon Sep 17 00:00:00 2001 From: Misha Kav Date: Sat, 18 Mar 2023 11:36:41 +0200 Subject: [PATCH] Fix generating coverage when all files `skip-covered` (#123) * fix parsing total line, by removing space * 1.1.47 * changelog * build --- CHANGELOG.md | 8 ++++++++ data/pytest-coverage_12.txt | 11 +++++++++++ dist/index.js | 2 +- package-lock.json | 4 ++-- package.json | 2 +- src/parse.js | 2 +- 6 files changed, 24 insertions(+), 5 deletions(-) create mode 100644 data/pytest-coverage_12.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index d3c3000..351a229 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog of the Pytest Coverage Comment +## [Pytest Coverage Comment 1.1.47](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.47) + +**Release Date:** 2023-03-18 + +#### Changes + +- Fix generating coverage report when all files `skip-covered` + ## [Pytest Coverage Comment 1.1.46](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.46) **Release Date:** 2023-03-03 diff --git a/data/pytest-coverage_12.txt b/data/pytest-coverage_12.txt new file mode 100644 index 0000000..84ea574 --- /dev/null +++ b/data/pytest-coverage_12.txt @@ -0,0 +1,11 @@ +============================= test session starts ============================== +platform linux -- Python 3.8.12, pytest-6.2.3, py-1.11.0, pluggy-0.13.1 + +---------- coverage: platform darwin, python 3.10.6-final-0 ---------- +Name Stmts Miss Cover Missing +------------------------------------- +------------------------------------- +TOTAL 2922 0 100% + +86 files skipped due to complete coverage. +Coverage XML written to file coverage.xml \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 46bb96b..2c64e74 100644 --- a/dist/index.js +++ b/dist/index.js @@ -17047,7 +17047,7 @@ const getTotal = (data) => { } const lines = data.split('\n'); - const line = lines.find((l) => l.includes('TOTAL ')); + const line = lines.find((l) => l.includes('TOTAL ')); return parseTotalLine(line); }; diff --git a/package-lock.json b/package-lock.json index 0e5dd70..5643011 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "pytest-coverage-comment", - "version": "1.1.46", + "version": "1.1.47", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "pytest-coverage-comment", - "version": "1.1.46", + "version": "1.1.47", "license": "MIT", "dependencies": { "@actions/core": "^1.10.0", diff --git a/package.json b/package.json index 800f7e2..e15bfcc 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "pytest-coverage-comment", - "version": "1.1.46", + "version": "1.1.47", "description": "Comments a pull request with the pytest code coverage badge, full report and tests summary", "author": "Misha Kav", "license": "MIT", diff --git a/src/parse.js b/src/parse.js index d8f041d..d773baf 100644 --- a/src/parse.js +++ b/src/parse.js @@ -73,7 +73,7 @@ const getTotal = (data) => { } const lines = data.split('\n'); - const line = lines.find((l) => l.includes('TOTAL ')); + const line = lines.find((l) => l.includes('TOTAL ')); return parseTotalLine(line); };