Issue with Jest tests in Next.js

I seem to be hitting an error with Jest tests when using DrizzleORM in my tests.

I get
Jest encountered an unexpected token

    Jest failed to parse a file. This happens e.g. when your code or its dependencies use non-standard JavaScript syntax, or when Jest is not configured to support such syntax.


And then

  /Users/a.laycock/Desktop/Work/project/database/client.ts:18
    const connection = await _promise.default.createConnection({
                       ^^^^^

    SyntaxError: await is only valid in async functions and the top level bodies of modules
Was this page helpful?