Skip to content

Rethink testing strategy #1019

Open
Open
@ph-fritsche

Description

@ph-fritsche

Problem description

  1. We run linting and tests on multiple node versions that we support according to

    user-event/package.json

    Lines 13 to 14 in ea50231

    "engines": {
    "node": ">=12",

    This has no merits.
    Our source code has no dependency on any NodeJS API, so that the result for the source itself will always be the same.
    The tested code is not the distributed code, so that if the different NodeJS versions yield different results, it only flags problems with our testing environment, but don't indicate anything about the build we would distribute from that commit.

  2. We don't test our build. Misconfigurations or bugs in our build tools result in broken builds being published and any potential fix is verified only by manually testing the build.

  3. We only test on Jsdom. We try to be platform agnostic, but out automation doesn't help us to develop software that works as intended in different environments, and the differences between Jsdom and e.g. Chrome are too numerous and wide for relying on manual testing only.

Suggested solution

  • Remove source tests on older node versions.
  • Refactor the tests so that they don't rely on Jest and could be run in different environments.
  • Run the tests in a headless browser during CI.
  • Split up our tests in
    a) those that rely on mocks or test internals and
    b) those that only interact with the DOM and can be observed using only the main export.
  • Add at least a smoke test on different node versions using the build.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions