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

Request for a synchronous variant of node:test.test() method #55107

Closed
WillAvudim opened this issue Sep 24, 2024 · 1 comment
Closed

Request for a synchronous variant of node:test.test() method #55107

WillAvudim opened this issue Sep 24, 2024 · 1 comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.

Comments

@WillAvudim
Copy link

WillAvudim commented Sep 24, 2024

What is the problem this feature will solve?

Currently, node:test.test() is defined as returning Promise. As a result, every test definition causes an eslint error about hanging promises, which requires a separate line for suppression:
// eslint-disable-next-line @typescript-eslint/no-floating-promises

What is the feature you are proposing to solve the problem?

Would it be possible to introduce a sync alias for the "test" function, which could be used to avoid having typed all these eslint overrides for every test we are writing? It would return void instead of Promise.

Pick any name you want, even something as ugly as sync_test() or synchronous_test() would do the trick.

What alternatives have you considered?

As you've probably already guessed, I have a line
// eslint-disable-next-line @typescript-eslint/no-floating-promises
proceeding every test I've written so far.

@WillAvudim WillAvudim added the feature request Issues that request new features to be added to Node.js. label Sep 24, 2024
@github-project-automation github-project-automation bot moved this to Awaiting Triage in Node.js feature requests Sep 24, 2024
@cjihrig
Copy link
Contributor

cjihrig commented Sep 24, 2024

Closing as a duplicate of #51292. My understanding is that typescript-eslint has a workaround for this now. I'm also considering dropping the return type in Node 23.

@cjihrig cjihrig closed this as completed Sep 24, 2024
@RedYetiDev RedYetiDev added duplicate Issues and PRs that are duplicates of other issues or PRs. and removed feature request Issues that request new features to be added to Node.js. labels Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate Issues and PRs that are duplicates of other issues or PRs.
Projects
None yet
Development

No branches or pull requests

3 participants