rule to enforce returning promise in async tests instead of done
See original GitHub issuedon’t know if it is possible to enforce usage of promise returns, probably not.
at least it should be possible to check that done
argument is not used and a return something
is used instead
Issue Analytics
- State:
- Created 7 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Results From Across the Web
Async and Await in JavaScript, the extension to a promise.
An async function simply implies that a promise will be returned and if a promise is not returned, JavaScript will automatically wrap it...
Read more >For async tests and hooks, ensure "done()" is called
For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. Now consider this slightly different test, ...
Read more >Testing-library: avoid these mistakes in async tests
Never forget to await for async functions or return promises from the test (jest will wait for this promise to be resolved in...
Read more >New rule: enforce async/await consistency #9787 - GitHub
Enforce that all functons that are being awaited be marked as async. Prohibit awaiting functions that are not returning pr...
Read more >Understanding the Event Loop, Callbacks, Promises, and ...
When an asynchronous Web API is used, the rules become more ... will execute the callback after the asynchronous action has completed.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Ok, sounds like it is a stylistic rule.I think we can do this by simply looking for the
done
argument and warn whenever it is specified. Checking if thereturn
statement is present could be covered by #5.Anyway, now that I have found a solution, I’m all for this rule, but the documentation should probably give tips on how to achieve this (normal case and my expected error case).