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

Different results when using GitHub Actions and TypeScript #522

Closed
wellwelwel opened this issue Mar 11, 2024 · 4 comments
Closed

Different results when using GitHub Actions and TypeScript #522

wellwelwel opened this issue Mar 11, 2024 · 4 comments

Comments

@wellwelwel
Copy link

wellwelwel commented Mar 11, 2024


  • Remote
    • Version:
      • Node.js: 20.x and 21.x
      • c8: 9.1.0
    • Platform: GitHub Actions (ubuntu-latest)
  • Local
    • Version:
      • Node.js: 20.x and 21.x
      • c8: 9.1.0
    • Platform: Darwin (arm64)

This is a similar issue to #325 and #426, but with a different behavior.

For context, the project is a test runner created using TypeScript and the tests are run without compile the .ts files.


The Issue

  • Locally, everything works well and the results really make sense.
  • In GitHub's ubuntu-latest CI, it shows 100% for absolutely everything.

Debugging

1. Remove my Test Runner

To check if this behavior was being caused by my test runner, I removed it and tried to do the same using popular testing tools, including the native from Node.js 21.

  • Locally, they all worked and gave the same result, as it should be.
  • In GitHub Actions, the same problem persists.

2. Change from tsx to ts-node

Just the same.


3. Compile TypeScript

Yes, by compiling it to .js now it works for both the environments.

But... This is a problem for this specific project.

Since this test runner allows testing without compile TypeScript using zero configs, it's expected that the test runner will be tested in the same way.


4. Using a Docker Container

I tried to test it using a node:lts-alpine for both local and remote environments.

Also worked, now without compile TypeScript for both, but...

Even ensuring that all coverage files exist by mounting a root volume to write the coverage results and upload them to Codecov, the Codecov finds the coverage data, but doesn't upload them and emit: unknown status.

By not using a Docker container to generate the coverage, all data are uploaded normally.


Unfortunately, I don't know how to reproduce this behavior, since everything works locally.

A CI result to illustrate:

See the "🧪 Checking for Coverage" tab

@wellwelwel

This comment was marked as resolved.

@Hoho5000
Copy link

What version of tsx are you using?

I came across this issue today and it was driving me crazy because it was working fine just last week.

I started backing out commits and reverting the tsx upgrade I did fixed it.

Trying to use a tsx version above 4.2.1 results in the behavior you're seeing in the action.

@wellwelwel
Copy link
Author

wellwelwel commented Mar 12, 2024

Thanks, @Hoho5000 🙋🏻‍♂️

I'll check it tomorrow and try to understand if the issue comes from c8 or tsx, since the same occurs with ts-node.

@wellwelwel
Copy link
Author

Oh, in fact the issue comes from tsx.

Related

@wellwelwel wellwelwel closed this as not planned Won't fix, can't repro, duplicate, stale Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants