lundi 7 septembre 2020

testcafe compilation failure due to `import type` - requires update to Typescript version 3.8

TLDR:

The version of TS that gets installed with testcafe is version 3.5.3. However, in order to use import Type syntax, which is used by various libraries, such as jest/create-react-app, etc, we need to be on TS version 3.8 at minimum.

When I try to run a TS file with testcafe, the error I get is the following:

$ ./scripts/test_smoke.sh --debug-on-fail test.ts
Hash: 43a08709b49b552d25bc
Version: webpack 4.41.5
Time: 2113ms
Built at: 09/07/2020 1:26:25 PM
   Asset      Size  Chunks             Chunk Names
index.js  1.92 MiB    main  [emitted]  main
Entrypoint main = index.js
[./node_modules/webpack/buildin/global.js] (webpack)/buildin/global.js 472 bytes {main} [built]
[./node_modules/webpack/buildin/module.js] (webpack)/buildin/module.js 497 bytes {main} [built]
[./test/smoke/polly/index.js] 3.79 KiB {main} [built]
    + 4 hidden modules
ERROR Cannot prepare tests due to an error.

Error: TypeScript compilation failed.
/Users/jonathan/web/node_modules/@testing-library/dom/node_modules/pretty-format/build/index.d.ts (7, 13): '=' expected.
/Users/jonathan/web/node_modules/@testing-library/dom/node_modules/pretty-format/build/index.d.ts (7, 18): ';' expected.
/Users/jonathan/web/node_modules/@testing-library/dom/node_modules/pretty-format/build/index.d.ts (7, 31): ';' expected.

All of these *.d.ts use the import Type syntax.

Aucun commentaire:

Enregistrer un commentaire