Repository navigation
Fix: 2 issues (#1699, #1700) - #1843
Merged
Akanimoh12 merged 1 commit intoNov 23, 2026
Merged
Conversation
Co-authored-by: Simple Agent <agent@simple.dev>
|
@CodingBabe-1 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1699
Closes #1700
Issues
#1699 Add tests for the service worker
#1700 Lazy-load html2canvas
Summary
The service worker test must mock globals before importing sw.ts; use vi.resetModules + dynamic import per test and a helper to dispatch events with a waitUntil collector. Prefer the in-file
// @vitest-environment nodepragma over config globs to keep changes minimal, but update both vitest configs if globs are used. For html2canvas, keep a single cached promise so repeated PDF exports reuse the loaded module, and verify with the bundle analyzer/size-limit that html2canvas lands in a separate chunk. No behavior change to CSV export.Changes
// @vitest-environment node) or configure an environmentMatchGlobs entry mapping 'src/sw.test.ts' to 'node' in both configs. Verify the include globs already match src/**/*.test.ts (they do) and that no setup file breaks under the chosen environment; if src/test/setup.ts assumes DOM, guard it or exclude the sw test from that setup via the project config. (frontend-scaffold/vitest.config.ts)vitest --config vitest.unit.config.tsalso runs src/sw.test.ts correctly: add the same environmentMatchGlobs (or rely on the in-file// @vitest-environment nodepragma) and confirm the include glob covers src/sw.test.ts. Keep the rest of the config unchanged. (frontend-scaffold/vitest.unit.config.ts)let html2canvasPromise: Promise<typeof import('html2canvas').default> | null = null; function loadHtml2Canvas() { if (!html2canvasPromise) html2canvasPromise = import('html2canvas').then((m) => m.default); return html2canvasPromise; }, and inside generatePDF await loadHtml2Canvas() right before rendering the table (keep the existing dynamic import of jspdf or load it lazily too). Ensure the function remains async and callers (exportTipHistoryPDF) already await the promise. Do not change the public API or the generated PDF output. (frontend-scaffold/src/helpers/export.ts)import('html2canvas')resolves to a module whosedefaultis the html2canvas function. Keep the existing default export declaration and add an explicitexport defaulttyping compatible withtypeof import('html2canvas').default; no runtime code changes. (frontend-scaffold/src/types/html2canvas.d.ts)