Skip to content

"await is only valid in async function" even with top-level await support #9667

Closed
@dandv

Description

@dandv

I've added '@babel/plugin-syntax-top-level-await' and am passing --harmony-top-level-await to Node v13.10, but Jest still returns a syntax error:

SyntaxError: await is only valid in async function

 at Runtime._execModule (../node_modules/jest-runtime/build/index.js:988:58)

Are there plans to support top-level await in tests, perhaps part of #9430?

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