Home > Mobile >  Jest complains about Typescript syntax
Jest complains about Typescript syntax

Time:07-19

When I run yarn test Jest throws an error that says

'Const declarations' require an initialization value.

Which is not what I'm doing!

> 4 | const config: HardhatUserConfig = {
    |             ^
  5 |   solidity: "0.8.9",
  6 |   paths: {
  7 |     artifacts: "./src/artifects",

I think it is obvious that jest is having problem with TS syntax.
How can I fix that?

CodePudding user response:

You need to use ts-jest.

  • Install ts-jest: npm install ts-jest -D
  • Update your jest config to use: preset: 'ts-jest'

You still run your tests the same way - just run jest.

  • Related