Skip to content

Jest 28 support #134

@birtles

Description

@birtles

Using jest-dynamodb after updating to jest 28 (specifically 28.1.0 at the time of writing, as well as updating ts-jest to 28.0.3) I get errors such as the following in all test suites:

  ● Test suite failed to run

    TypeError: Class extends value #<Object> is not a constructor or null

      at Object.<anonymous> (node_modules/@shelf/jest-dynamodb/environment.js:5:52)
      at Object.newLoader (node_modules/pirates/lib/index.js:141:7)
      at ScriptTransformer.requireAndTranspileModule (node_modules/@jest/transform/build/ScriptTransformer.js:895:66)

This appears to be because Jest 28 no longer exports NodeEnvironment as a default import, but is now a named import

In addition, test environments are now exported with the name TestEnvironment, instead of simply exporting the class directly
https://jestjs.io/docs/upgrading-to-jest28#test-environment

It's an easy fix but I guess it would break anyone still on Jest 27? So it would be a major version bump?

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