Skip to content

Implement async code transformations #9504

@SimenB

Description

@SimenB

EcmaScript Modules can (actually must, but easy to wrap the sync stuff in a promise) resolve asynchronously. While it's in no way a blocker for ESM support in Jest, it would be nice to add support for async transforms to be used.

This logic should for now not impact anything in Jest beyond @jest/transform as Jest wouldn't use it until ESM support is in place.

I'm thinking we can add a .transformAsync and .transformSourceAsync to the ScriptTransformer class.

There are some checks and verifications that process is a function - we need to make sure there is one clear code path for sync and one for async transformation that verify the provided reporter implements the correct interface.

Sort of reopening #5556 and all its linked issues.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions