Skip to content

Front-end: Investigate unit tests for NextJS pages #74

Closed

Description

@bryphe-coder

On the front-end, we currently have quite a bit of code coverage, but there is one spot that is currently difficult to test.

The /pages directory has special properties in NextJS:

  • Every file in there is pulled in as a top-level route
  • There is some ambient context in the form of routes

We'll have to revisit our testing approach for these files. For pages, we'll likely need a separate directory so that the tests don't get included in the bundle or as routes (there may be a way to configure next for this).

It's possible we can just directly import them and run them, however, we may need to investigate using a library like next-page-tester.

Activity

  1. bryphe-coder commented on Jan 26, 2022

    @bryphe-coder
    ContributorAuthor

    Looks like we can change the extensions for our pages to filter out the test files, to address the first bullet point: https://nextjs.org/docs/api-reference/next.config.js/custom-page-extensions#including-non-page-files-in-the-pages-directory

  2. misskniss commented on Mar 28, 2022

    @misskniss

    @vapurrmaid do we still need this issue with the work to move off Next recently? If not will you close it?

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions