Skip to content

Improve test coverage and Node environment#19

Merged
ccombe merged 9 commits intomasterfrom
chore/updates
Feb 28, 2026
Merged

Improve test coverage and Node environment#19
ccombe merged 9 commits intomasterfrom
chore/updates

Conversation

@ccombe
Copy link
Owner

@ccombe ccombe commented Feb 27, 2026

Silenced noisy test output and increased overall coverage to 90.5%. Set up .nvmrc for Node v24 LTS latest (Krypton) and configured Git auto-upstream.

Copilot AI review requested due to automatic review settings February 27, 2026 23:40
@ccombe ccombe self-assigned this Feb 27, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a4cb18fcf

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR focuses on expanding Vitest coverage around core logic, storage, and Google Fit integration while also tightening the project’s Node/tooling configuration (Node version, pnpm/lockfile updates, and a Rollup override).

Changes:

  • Added/expanded unit tests for StorageService, core timer logic edge cases, and GoogleFitService behaviors (token expiry, init/connect, error paths).
  • Updated Node/tooling configuration via package.json engines and pnpm lockfile changes (including a Rollup override).
  • Added an .nvmrc to guide local Node selection.

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/ts/storage.test.ts Adds settings persistence tests (but currently introduces an order-dependent/flaky test).
src/ts/logic.test.ts Adds edge-case tests for getCurrentRound and getCountdownBeep.
src/ts/google-fit.test.ts Adds constructor/init/connect/error-path coverage and reduces noisy stderr in some tests.
pnpm-workspace.yaml Introduces a Rollup override configuration.
pnpm-lock.yaml Updates lockfile to reflect overrides and dependency changes.
package.json Adds Node engine requirement and modifies dependencies.
.nvmrc Introduces Node major version pinning for local dev.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ccombe
Copy link
Owner Author

ccombe commented Feb 27, 2026

@codex review

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 8 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b2bbe10d47

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copilot AI review requested due to automatic review settings February 28, 2026 00:02
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 28, 2026 00:07
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ccombe ccombe merged commit 0ce062d into master Feb 28, 2026
4 checks passed
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 8 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +50 to +53
const newService = new GoogleFitService();
expect(newService.accessToken).toBeNull();
expect(localStorage.getItem('google_fit_token')).toBeNull();
logSpy.mockRestore();
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logSpy.mockRestore() (and similar console spies later in this file) is called after assertions; if an assertion throws, the spy won't be restored and can leak into subsequent tests. Prefer wrapping the spy usage in try/finally, or add an afterEach that calls vi.restoreAllMocks() so the original console methods are always restored.

Suggested change
const newService = new GoogleFitService();
expect(newService.accessToken).toBeNull();
expect(localStorage.getItem('google_fit_token')).toBeNull();
logSpy.mockRestore();
try {
const newService = new GoogleFitService();
expect(newService.accessToken).toBeNull();
expect(localStorage.getItem('google_fit_token')).toBeNull();
} finally {
logSpy.mockRestore();
}

Copilot uses AI. Check for mistakes.
"packageManager": "pnpm@10.30.3",
"pnpm": {
"overrides": {
"rollup@>=4.0.0 <4.59.0": ">=4.59.0"
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pnpm override value ">=4.59.0" is open-ended, which can make installs non-reproducible (it may float to newer major versions) and can unexpectedly change behavior in CI/local dev. Consider pinning to a specific version (e.g., 4.59.0) or a bounded range (e.g., ^4.59.0) depending on your upgrade policy.

Suggested change
"rollup@>=4.0.0 <4.59.0": ">=4.59.0"
"rollup@>=4.0.0 <4.59.0": "^4.59.0"

Copilot uses AI. Check for mistakes.
Comment on lines +11 to +13
await new Promise((resolve, reject) => {
request.onsuccess = resolve;
request.onerror = reject;
Copy link

Copilot AI Feb 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this Promise wrapper around indexedDB.deleteDatabase, request.onerror = reject will reject with the raw event rather than the underlying request.error, which makes failures harder to diagnose. Consider rejecting with request.error (or a new Error that includes request.error?.message) so test failures are actionable.

Suggested change
await new Promise((resolve, reject) => {
request.onsuccess = resolve;
request.onerror = reject;
await new Promise<void>((resolve, reject) => {
request.onsuccess = () => {
resolve();
};
request.onerror = () => {
const error = request.error;
if (error) {
reject(error);
} else {
reject(new Error(`IndexedDB deleteDatabase("${DB_NAME}") failed for an unknown reason.`));
}
};

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants