0

We have a huge testcafe e2e tests database and as a part of TS migration I'm rewriting test helper files to TypeScript.

But when I import a .ts helper inside of a .js test, test run fails with a syntax error not recognizing TypeScript syntax.

What am I doing wrong and what's the right way to do it?

Alex Skorkin
  • 4,264
  • 3
  • 25
  • 47
Mike Doudkin
  • 640
  • 1
  • 6
  • 16

1 Answers1

1

Such a scenario is not meant to work and it's not described in TestCafe's documentation. It looks like the incompatibility of the import statement from the js file (processed by the Babel preprocessor internally) and the import statement from the ts file (processed by the TypeScript compiler internally). Try to set the allowJs option of the TypeScript compiler using TestCafe's --compiler-options setting.

mlosev
  • 5,130
  • 1
  • 19
  • 31
  • tried that, but nothing has changed. anyway, I think I'll wait with this feature until testcafe allows for configuring babel/ts – Mike Doudkin Mar 02 '21 at 14:42