Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ava test() expression is not callable / has no call signatures #3349

Open
zavoloklom opened this issue Nov 10, 2024 · 4 comments
Open

Ava test() expression is not callable / has no call signatures #3349

zavoloklom opened this issue Nov 10, 2024 · 4 comments

Comments

@zavoloklom
Copy link

After updating Typescript from 5.5.4 to 5.6.3 i started to have an error

error TS2349: This expression is not callable.
  Type 'typeof import("<full_path_to_project>/node_modules/ava/entrypoints/main")' has no call signatures.

Version of ava - 6.2.0
Version of Typescript - 5.6.3
Version of tsimp - 2.0.12

ava config

export default {
  files: ['tests/**/*.spec.ts'],
  extensions: {
    ts: 'module',
  },
  nodeArguments: ['--import=tsimp/import', '--no-warnings'],
  timeout: '2m',
  serial: true,
  concurrency: 1,
};

test example

import test from 'ava';
import type { ExecutionContext } from 'ava';

test('example', (t: ExecutionContext) => {
  t.is('8080', '8080');
});

I expect not to have this warning from Typescript when using Ava.

There was similar issue #2539, but it's closed and nothing from comments there helping me (first of all because I can not use require syntax).

@novemberborn
Copy link
Member

Can you reproduce this outside of your project? With and without tsimp/import? Nothing would have changed in AVA so it suggests a problem elsewhere.

@KillyMXI
Copy link
Contributor

Same issue.
Same versions of ava, TypeScript, tsimp.

Tests are still passing, but there are also these error messages in the output.
The one as reported above and the other:

error TS7006: Parameter 't' implicitly has an 'any' type.

@novemberborn
Copy link
Member

@KillyMXI Can you reproduce this outside of your project? With and without tsimp/import? Nothing would have changed in AVA so it suggests a problem elsewhere.

@KillyMXI
Copy link
Contributor

KillyMXI commented Dec 24, 2024

All experiments done with Node.js v20.18.0

The issue reproduces if I bump typescript version to 5.6.3 or 5.7.2.

Trying to replace tsimp:

  • tsx - can't make it work anymore;
  • ts-node with "--loader=ts-node/esm" - it gives a warning about --experimental-loader, but no type errors.

Trying to roll back versions of tsimp:

  • ava times out when using tsimp 2.0.11 and typescript 5.6.3 or 5.7.2 - only works with 5.5.4. No useful messages in case of timeout:
> npx ava --verbose


  ✘ Timed out while running tests

  Failed to exit when running test-ava\test.ts

Trying tsimp 2.0.12 and typescript 5.5.4 (clean npm i) - no errors.

tsimp 2.0.11 tsimp 2.0.12
typescript 5.5.4 fine fine
typescript 5.6.3, 5.7.2 timeout test pass with displayed errors

After facing the issue in one of my packages repo, I reproduced this in my playground repo with a single trivial test.
My repro branch: https://github.com/mxxii/yet-another-typescript-package-template/tree/tsimp-issue-repro
Test run log with the error messages: https://github.com/mxxii/yet-another-typescript-package-template/actions/runs/12484026510/job/34840790959#step:5:10
(Edit: logs are not public, but the error messages are also shown in the Annotations section.)

image

I've no idea how ava uses tsimp, so I'm not sure if this is enough to bring to their repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants