Skip to content

test: enforce ESLint test-quality rules and Jest coverage floors#364

Merged
ZappoMan merged 8 commits into
developfrom
test/test-quality-linting
May 23, 2026
Merged

test: enforce ESLint test-quality rules and Jest coverage floors#364
ZappoMan merged 8 commits into
developfrom
test/test-quality-linting

Conversation

@ZappoMan
Copy link
Copy Markdown
Contributor

Summary

  • Add Vitest, Jest, Testing Library, and jest-dom ESLint plugins to catch hollow tests, focused/skipped suites, conditional expects, and async RTL anti-patterns
  • Fix flagged tests across web, mobile, shared-tests, billing, marketing-email, and integration suites
  • Add Jest coverage thresholds for mobile and shared-tests (with platform-scoped collectCoverageFrom exclusions)

Test plan

  • npm run lint and npm run lint:repo
  • Mobile and shared-tests coverage runs pass with new thresholds
  • marketing-email package at 100/100/100/100 coverage
  • CI Test workflow on this PR

Add vitest/jest/RTL lint plugins, fix flagged tests, and align mobile
and shared-tests coverage thresholds with existing Vitest discipline.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

CI Coverage & Test Summary

Metric Coverage Covered / Total
Statements 99.85% 18539 / 18567
Branches 98.16% 4843 / 4934
Functions 99.22% 767 / 773
Lines 99.88% 18508 / 18530

Suites: 62 passed, 0 failed (62 total) · Tests: 658 passed, 0 failed (658 total)

✅ All reported test suites passed.

Coverage artifacts: coverage-summary, coverage-packages.


Updated at: May 23, 2026 at 2:00 PM PDT

Copy link
Copy Markdown

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 tightens test quality enforcement across the monorepo by adding ESLint plugins/rules for Vitest/Jest/Testing Library patterns and by introducing Jest coverage floors (with platform-specific coverage exclusions) for mobile and shared-tests.

Changes:

  • Add ESLint test-quality plugins/rules (Vitest, Jest, Testing Library, jest-dom) to detect skipped/focused tests, conditional expects, and async RTL anti-patterns.
  • Refactor existing tests across web/mobile/shared/integration/packages to comply with the new lint rules.
  • Add/adjust Jest coverage collection exclusions and enforce global coverage thresholds for mobile and shared-tests.

Reviewed changes

Copilot reviewed 27 out of 28 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/integration/marketing-email-queue.test.ts Replaces null-error expectations with throwing on Supabase errors in integration setup/teardown.
tests/integration/billing-edge.test.ts Refactors Edge integration test assertions and conditional test registration.
tests/integration/auth.test.ts Refactors conditional expect logic in auth integration tests to satisfy lint rules.
tests/integration/auth-rls.test.ts Refactors RLS integration assertions (includes a logic change that affects correctness).
packages/shared-tests/jest.web.cjs Adds web coverage exclusions for native-only shared code + sets global coverage threshold.
packages/shared-tests/jest.native.cjs Adds native coverage exclusions for web-only shared code + sets global coverage threshold.
packages/shared-tests/tests/validation/profileSchema.test.ts Adds helper to avoid conditional expects in schema validation tests.
packages/shared-tests/tests/hooks/useAvatarUpload.coverage.test.ts Updates coverage-gap tests to satisfy expect-expect and remove try/catch swallowing.
packages/shared-tests/tests/hooks/useAuth.native.test.ts Refactors error assertions to avoid conditional expects.
packages/shared-tests/tests/components/profile/ProfileEditor.test.tsx Removes waitFor side-effects pattern in favor of explicit waits + assertions.
packages/shared-tests/tests/components/profile/ProfileEditor.native.test.tsx Same as web: refactors waitFor usage to avoid side-effects.
packages/shared-tests/tests/components/navigation/UserMenu.native.test.tsx Converts “findByText only” usage into an explicit assertion to satisfy linting.
packages/shared-tests/tests/components/navigation/UserMenu.native.coverage.test.tsx Same as above for coverage-gap suite.
packages/shared-tests/tests/components/forms/FormInput.test.tsx Uses jest-dom matchers (toBeDisabled/toBeRequired) per new lint rules.
packages/shared-tests/tests/components/forms/FormButton.test.tsx Uses jest-dom matchers (toBeDisabled/toBeEnabled) per new lint rules.
packages/marketing-email/src/tests/kitClient.test.ts Expands/clarifies kit client tests and adds new error-message case.
packages/marketing-email/src/tests/kitAdapter.test.ts Refactors error assertions to avoid conditional expects and ensure assertions always run.
packages/billing/src/BillingProvider.test.tsx Adds an assertion to prevent late async work after unmount.
package.json Adds ESLint plugins for test-quality enforcement.
package-lock.json Locks new ESLint plugin dependencies (and transitive updates).
apps/web/src/pages/tests/DashboardPage.test.tsx Simplifies user-menu querying and sign-out assertions.
apps/web/src/lib/supabase.test.ts Converts manual runtime skip logic to Vitest it.skipIf.
apps/web/src/components/dashboard/tests/CollectionDetail.test.tsx Switches to toBeEnabled matcher.
apps/web/src/components/billing/tests/PlanCard.web.test.tsx Switches to toBeEnabled matcher.
apps/web/src/components/tests/SocialLoginButton.test.tsx Switches to toBeEnabled matcher.
apps/mobile/package.json Adds Jest global coverageThreshold floors for the mobile app.
apps/mobile/tests/screens/SignupScreen.test.tsx Refactors waitFor usage to avoid side-effects and satisfy lint rules.
.eslintrc.js Adds targeted overrides for Vitest/Jest/Testing Library/jest-dom test-quality rules.

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

Comment thread tests/integration/auth-rls.test.ts Outdated
Comment thread tests/integration/auth.test.ts Outdated
Align CI merged coverage totals with local npm run test:coverage by
running test:coverage:logger in the matrix and restoring its artifact.
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 23, 2026

Component Status Link
🌐 Web ✅ Deployed Preview →
🗄️ Database
💳 Billing ✅ Deployed
📱 Mobile ✅ Deployed

Last deployed: 14:08 PDT


📱 Mobile preview: Channel pr-364

📱 Mobile Preview Builds

Native builds are available for download:

iOS Simulator Build:

  • Download .app file
  • Install with: xcrun simctl install booted ~/Downloads/BeakerStack.app

Android Build (Device & Emulator):

Note: These builds include the preview Supabase configuration and are ready to use.

📖 See Mobile Build Testing Guide for detailed instructions.

…pass.

Separate shared coverage outputs per platform and merge them so CI reports both web and native shared code instead of native overwriting web results.
…tests.

Copilot review: !== undefined treated null success responses as errors.
Copy link
Copy Markdown

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 33 out of 34 changed files in this pull request and generated 5 comments.

Comment thread scripts/lib/merge-istanbul-coverage.js Outdated
Comment thread tests/integration/auth-rls.test.ts
Comment thread tests/integration/auth.test.ts
Comment thread scripts/__tests__/merge-istanbul-coverage.test.mjs
Comment thread scripts/__tests__/merge-istanbul-coverage.test.mjs
ZappoMan added 3 commits May 23, 2026 13:41
Guard source-map spreads with nullish coalescing, add regression coverage, and register the merge test in test:unit:scripts.
Integration suite lives in supabase-tests, but tests/integration/** only set app_code so run_supabase stayed false on test-only PR pushes.
Refactor aggregation/derived-flag logic so --self-test verifies integration-only paths trigger Supabase CI without preview reset.
Copy link
Copy Markdown

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 34 out of 35 changed files in this pull request and generated 1 comment.

Comment thread package.json
Align engines, docs, and CI setup-node with eslint-visitor-keys@5 and existing Node 20 CI; add .nvmrc for local development.
@ZappoMan ZappoMan merged commit b9cc6f5 into develop May 23, 2026
34 checks passed
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