Skip to content

Sporadic context canceled in stderr when running TypeScript API in subprocess tests #64242

Description

🔎 Search Terms

My project is a CLI app that uses TypeScript's programmatic APIs. I test it by spawning a subprocess and asserting the resulting stdout and stderr.

Tests fail sporadically in CI with unexpected context canceled\n appearing in stderr instead of an empty string. The failures always happen on Ubuntu runners in GitHub Actions, occasionally on macOS, but never on Windows.

The reproduction can be found here: https://github.com/mrazauskas/x-ts-api-context-canceled

Please have a look at all three reruns. Different test cases are failing each time, so I suspect this can be a race condition somewhere in Go code.

🕗 Version & Regression Information

  • This changed between versions 6.0 and 7.0 (the reproduction is using typescript@next)

⏯ Playground Link

No response

💻 Code

The reproduction can be found here: https://github.com/mrazauskas/x-ts-api-context-canceled

🙁 Actual behavior

Sporadic context canceled\n in stderr.

🙂 Expected behavior

An empty string in stderr.

Additional information about the issue

The issue disappears if the async APIs are used instead. The same tests are always passing, see: mrazauskas/x-ts-api-context-canceled#1

Activity

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

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