diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6bad4f7..4d7ec21 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: with: node-version: "14.x" - run: npm ci - - run: npm test + - run: npm run test:coverage - name: Report Tachometer Result uses: ./ with: @@ -31,7 +31,7 @@ jobs: with: node-version: "14.x" - run: npm ci - - run: npm test + - run: npm run test:coverage - name: Report Other Tachometer Result uses: andrewiggins/tachometer-reporter-action@master with: diff --git a/dist/util.js b/dist/util.js index b16094a..4563642 100644 --- a/dist/util.js +++ b/dist/util.js @@ -14035,6 +14035,7 @@ function getStateName(state) { return state; } else { const keys = Object.keys(state); + /* c8 ignore next 3 */ if (keys.length !== 1) { throw new Error(`Unexpected state shape object returned: ${state}`); } @@ -14431,6 +14432,7 @@ async function acquireCommentLock(github, context, getInitialBody, logger) { break; } + /* c8 ignore next 2 */ default: throw new Error(`Unexpected stateName: ${JSON.stringify(stateName)}`); } @@ -14515,6 +14517,7 @@ async function readComment(github, context, logger) { } } } + /* c8 ignore next 4 */ } catch (e) { logger.warn("Error trying to read comments: " + e.message); logger.debug(() => e.toString()); @@ -14531,6 +14534,7 @@ async function readComment(github, context, logger) { * @returns {Promise} */ async function updateComment(github, context, body, logger) { + /* c8 ignore next 3 */ if (context.commentId == null) { throw new Error(`Cannot update comment if "context.commentId" is null`); } @@ -14616,6 +14620,8 @@ async function postOrUpdateComment(github, context, getCommentBody, logger) { try { const body = getFinalBody(context, getCommentBody, comment); comment = await updateComment(github, context, body, logger); + + /* c8 ignore next 4 */ } catch (e) { logger.info(`Error updating comment: ${e.message}`); logger.debug(() => e.toString()); diff --git a/package.json b/package.json index 03161ef..227dd8b 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,7 @@ "build:index": "sucrase --production -t jsx --jsx-pragma h -d lib ./src", "build:action": "rollup -c ./rollup.config.js", "test": "uvu tests", - "test:coverage": "c8 --reporter=html --reporter=text npm test" + "test:coverage": "c8 --check-coverage --statements 100 --reporter=html --reporter=text npm test" }, "repository": { "type": "git", diff --git a/src/comments.js b/src/comments.js index 0018170..4ad5023 100644 --- a/src/comments.js +++ b/src/comments.js @@ -61,6 +61,7 @@ function getStateName(state) { return state; } else { const keys = Object.keys(state); + /* c8 ignore next 3 */ if (keys.length !== 1) { throw new Error(`Unexpected state shape object returned: ${state}`); } @@ -457,6 +458,7 @@ async function acquireCommentLock(github, context, getInitialBody, logger) { break; } + /* c8 ignore next 2 */ default: throw new Error(`Unexpected stateName: ${JSON.stringify(stateName)}`); } @@ -541,6 +543,7 @@ async function readComment(github, context, logger) { } } } + /* c8 ignore next 4 */ } catch (e) { logger.warn("Error trying to read comments: " + e.message); logger.debug(() => e.toString()); @@ -557,6 +560,7 @@ async function readComment(github, context, logger) { * @returns {Promise} */ async function updateComment(github, context, body, logger) { + /* c8 ignore next 3 */ if (context.commentId == null) { throw new Error(`Cannot update comment if "context.commentId" is null`); } @@ -642,6 +646,8 @@ async function postOrUpdateComment(github, context, getCommentBody, logger) { try { const body = getFinalBody(context, getCommentBody, comment); comment = await updateComment(github, context, body, logger); + + /* c8 ignore next 4 */ } catch (e) { logger.info(`Error updating comment: ${e.message}`); logger.debug(() => e.toString()); diff --git a/tests/results/multi-measure-no-names.json b/tests/results/multi-measure-no-names.json index 87cb524..577ed28 100644 --- a/tests/results/multi-measure-no-names.json +++ b/tests/results/multi-measure-no-names.json @@ -44,7 +44,7 @@ }, { "absolute": { - "low": 2.303351653674162, + "low": 0, "high": 4.610315012993788 }, "percentChange": { @@ -434,7 +434,7 @@ { "absolute": { "low": -4.610315012993788, - "high": -2.303351653674162 + "high": 0 }, "percentChange": { "low": -20.522852558105033,