diff --git a/generate-upload-coverage.sh b/generate-upload-coverage.sh new file mode 100755 index 0000000..d266cb5 --- /dev/null +++ b/generate-upload-coverage.sh @@ -0,0 +1,3 @@ +#!/bin/bash +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +nx test && bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r ${SCRIPT_DIR}/coverage/dominion-assistant/lcov.info diff --git a/package.json b/package.json index 0f874e5..9abb181 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,7 @@ "build": "nx build", "build:clean": "yarn clean && yarn build", "test:jest": "nx test", + "test:jest:upload-codacy": "/workspaces/dominion-assistant/generate-upload-coverage.sh", "test:jest:single": "npx nx test dominion-assistant --coverage=false --testPathPattern", "test:playwright": "npx nx run e2e:e2e", "test:playwright:report": "yarn playwright show-report --host 0.0.0.0 dist/.playwright/e2e/playwright-report", diff --git a/src/game/__tests__/dominion-lib-load-save-restoreSavedGame.spec.ts b/src/game/__tests__/dominion-lib-load-save-restoreSavedGame.spec.ts index cb53ab0..badabe2 100644 --- a/src/game/__tests__/dominion-lib-load-save-restoreSavedGame.spec.ts +++ b/src/game/__tests__/dominion-lib-load-save-restoreSavedGame.spec.ts @@ -45,10 +45,10 @@ describe('restoreSavedGame', () => { expect(result.log[0].timestamp).toBeInstanceOf(Date); - // Allow for a 5-millisecond difference tolerance due to floating point precision + // Allow for a 15-millisecond difference tolerance due to floating point precision const restoredTime = result.log[0].timestamp.getTime(); const originalTime = saveGameTime.getTime(); - expect(Math.abs(restoredTime - originalTime)).toBeLessThanOrEqual(5); // Compare with tolerance + expect(Math.abs(restoredTime - originalTime)).toBeLessThanOrEqual(15); // Compare with tolerance }); it('should throw an error when a log entry has an invalid timestamp', () => {