Skip to content

[Q] Proper setup / Cannot use import statement outside a module #43

Closed
@sculpt0r

Description

@sculpt0r

Please provide details about:

  • What you're trying to do
  • What happened
  • What you expected to happen

Please share relevant sample code. Or better yet, provide a link to a minimal reproducible example.

We'll also need your AVA configuration (in package.json or ava.config.* configuration files) and how you're invoking AVA. Share the installed AVA version (get it by running npx ava --version) and @ava/babel version (from your package.json file).

I try to setup AVA 4 with TS for a bigger project. But to simplify things I reduce the problem to a simply project: https://github.com/sculpt0r/AVAwithTS

Now I try to run npm run test. The results is:
image

I tried to follow the documentation of AVA & this plugin:

  • installed AVA (4.3.0)
  • installed @ava/typescript (3.0.1)
  • also I found that it should be useful to additionally install source-map-support - so I did it and in cfg file I added:
"require": ['source-map-support/register']
  • in .tsconfig the outDir is set to the same directory (build) as in AVA config rewrite paths
  • also the compile is set to tsc, but if I try to run tests with compile set on false and the build directory already contains js files - I receive the same results as in the screenshot above

I assume I'm missing something - but I'm not sure what? Is it possible to take a look at the sample project: https://github.com/sculpt0r/AVAwithTS, then run npm i and then npm run test.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions