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

test for .ts files not working #663

Open
4 of 6 tasks
ficu88 opened this issue Oct 9, 2024 · 10 comments · May be fixed by #665
Open
4 of 6 tasks

test for .ts files not working #663

ficu88 opened this issue Oct 9, 2024 · 10 comments · May be fixed by #665
Labels
bug Something isn't working pending triage

Comments

@ficu88
Copy link

ficu88 commented Oct 9, 2024

Acknowledgements

  • I read the documentation and searched existing issues to avoid duplicates
  • I understand this is a bug tracker and anything other than a proven bug will be closed
  • I understand this is a free project and relies on community contributions
  • I read and understood the Contribution guide

Minimal reproduction URL

https://stackblitz.com/edit/node-hzy2ii?file=package.json,bar.test.ts

Problem & expected behavior (under 200 words)

When you run tsx --test , the file bar.test.ts is not executed.

https://tsx.is/node-enhancement#test-runner

Bugs are expected to be fixed by those affected by it

  • I'm interested in working on this issue

Compensating engineering work will speed up resolution and support the project

  • I'm willing to offer $10 for financial support
@ficu88 ficu88 added bug Something isn't working pending triage labels Oct 9, 2024
@CodeHowlerMonkey

This comment was marked as off-topic.

@ficu88

This comment was marked as off-topic.

@privatenumber
Copy link
Owner

Issues is a place for discussing solutions that can land in tsx.

As per the Contribution guide, please avoid discussing work arounds here.

If you can investigate a solution, please open a PR

@berniegp
Copy link

@ficu88 are you on a version of Node before v21? I'm on v20 and get the same behavior.
From the description in the PR that adds test runner support, the feature only works on Node v21 and above.

If that's correct, perhaps the "fix" is to amend the docs to mention the Node version requirements for the test runner integration.

Side note for the maintainer: Respectfully the two comments marked as off-topic were helpful for me. For those who can't upgrade to Node v21+ any workaround is useful!

@privatenumber
Copy link
Owner

are you on a version of Node before v21?

See the reproduction Node version:

❯ node -v
v18.20.3

If that's correct, perhaps the "fix" is to amend the docs to mention the Node version requirements for the test runner integration.

Happy to accept a PR, would you be open to working on one?

Respectfully the two comments marked as off-topic were helpful for me. For those who can't upgrade to Node v21+ any workaround is useful!

As a maintainer, my priority is to serve sponsors first, then contributors, and finally users.

For sponsors needing a workaround, I'm happy to offer support directly via the sponsors-only repo.

The Issues tab is a place for contributors to collaborate and fix bugs to benefit all tsx users, and it's distracting/unproductive when the thread is polluted with workaround noise by non-contributors.

@berniegp berniegp linked a pull request Oct 13, 2024 that will close this issue
@berniegp

This comment was marked as spam.

@privatenumber

This comment was marked as off-topic.

@berniegp

This comment has been minimized.

@OnkelTem
Copy link

OnkelTem commented Oct 23, 2024

Node LTS v.20 here

I run tests. For the following file tree:

src/
  commands.test.js

this works:

$ node --test src                       # is successfully executing  the `src/commands.test.js` tests

However for a similar TS location:

src/
  commands.test.ts

tsx doesn't find test files:

$ npx tsx --test src                    # is finding 0 tests

Yet if I pass the path it works:

$ npx tsx --test src/commands.test.ts   # is successfully executing  the `src/commands.test.ts` tests
$ npx tsx --test src/*.test.ts          # is successfully executing  the `src/commands.test.ts` tests

There is no such issue for Node v.21, but we're on the LTS Node v.20.

So it seems to be a test files discovery issue. Maybe it's worth adding the appropriate info to the docs here?

@privatenumber
Copy link
Owner

Yeah, feel free to open a PR to update the docs.

Explanation is in the PR: #410 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants