Skip to content

Commit

Permalink
upload coverage to codacy
Browse files Browse the repository at this point in the history
  • Loading branch information
JessicaMulein committed Oct 18, 2024
1 parent b198e7d commit 9fbe7b2
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
3 changes: 3 additions & 0 deletions generate-upload-coverage.sh
Original file line number Diff line number Diff line change
@@ -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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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', () => {
Expand Down

0 comments on commit 9fbe7b2

Please sign in to comment.