Skip to content

Test hangs or times out on some TypeScript compilation errors. #3031

Closed

Description

@paulgb

When I run this test:

import test from 'ava'

test('foobar', async (t) => {
    const foo_1 = foo()
    const foo_2 = foo()
    const foo_3 = foo()
    const foo_4 = foo()
    const foo_5 = foo()
    const foo_6 = foo()
    const foo_7 = foo()
})

Instead of reporting a compilation error, I get this:

  ✖ Timed out while running tests

If I remove one of the declarations, I get the following, as expected:

  Uncaught exception in src/test-spawn.ts

  src/test-spawn.ts(4,19): error TS2304: Cannot find name 'foo'.
  src/test-spawn.ts(5,19): error TS2304: Cannot find name 'foo'.
  src/test-spawn.ts(6,19): error TS2304: Cannot find name 'foo'.
  src/test-spawn.ts(7,19): error TS2304: Cannot find name 'foo'.
  src/test-spawn.ts(8,19): error TS2304: Cannot find name 'foo'.
  src/test-spawn.ts(9,19): error TS2304: Cannot find name 'foo'.
  

  ✖ src/test-spawn.ts exited with a non-zero exit code: 1
  ─

  1 uncaught exception

It seems there's some threshold (maybe the amount of tsc output?) that's causing ava to time out rather than report the error.

This occurs when using the ts-node/register TypeScript approach (https://github.com/avajs/ava/blob/main/docs/recipes/typescript.md#for-packages-without-type-module).

I've created a minimal reproducible example here: https://github.com/paulgb/ava-timeout-issue-repro

Activity

  1. locked and limited conversation to collaborators on May 29, 2022
  2. converted this issue into a discussion #3033 on May 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions