Skip to content

analytics.ts trackPageview module-level lastPageviewPath is not reset between test files without explicit call #944

Open

Description

@nonsobethel0-dev

Summary

trackPageview in src/lib/analytics.ts stores lastPageviewPath at module level. The resetPageviewTracking test helper exists, but it must be explicitly called in every test file's beforeEach. If a test file forgets to call it, the previous test file's last-pageview state persists, causing trackPageview to silently skip the first call in the new test.

Severity

Low

Suggested Fix

Either auto-reset in a global test setup file (setupTests.ts), or use a ref-based pattern that's scoped to the component/hook instance.

Activity

  1. added
    bug
    on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions