Cannot use import statement outside a module after upgrading @swc-node/jest
After upgrading @swc-node/jest from 1.5.5 to 1.6.2 I get next error while running jest tests.
/workspaces/app/__integration__/app.test.ts:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import _async_to_generator from "@swc/helpers/src/_async_to_generator.mjs";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1678:14)
at runMicrotasks (<anonymous>)
while having module: "esnext" in the tsconfig
It is probably related to https://github.com/swc-project/swc-node/issues/693
Same issue here. I see it's because of this commit: https://github.com/swc-project/swc-node/commit/e353c1a4843671fc7a8f5ccc5727ab260e060565, which overrides the externalHelpers to true for @swc-node/jest. @Brooooooklyn Is it possible to accept option for externalHelpers?
Hello
Did you find a workaround 🙏 ?
thank you!
Hello
Did you find a workaround 🙏 ?
thank you!
I didn't find a workaround with @swc-node/jest. However, when I turned to @swc/jest our application just worked without problem. You can have a try.
running into similar issues here. Can anyone explain the difference between @swc-node/jest and @swc/jest?
Also @gyz0072004 - do you have an example of your setup anywhere? Seems to be quite tricky to get everything (including setup / teardown files in TS) to play nicely.