deno
deno copied to clipboard
fix(ext/node/polyfills): New async setInterval function to improve the nodejs compatibility
#26499
This PR adds a better implementation of setInterval using async functions, similar to the one in Node.js. It's mostly based on the Node.js version, with some updates to error handling and logic.
The PR is complete, but I need help with:
- Running a single test file
- Deciding where to place my test files
Currently, I have a test to validate my code, but I’m running it outside of cargo test because running all tests at once is frustrating and often causes my system to freeze due to high memory use. This issue occurred even before my changes.
Thanks for the PR!
Deciding where to place my test files
I would recommend adding your test as a unit test to this file: https://github.com/denoland/deno/blob/770ef1460085e1a1b706cc7f066e7b3ea5010eb0/tests/unit_node/timers_test.ts#L102-L110
Running a single test file
Assuming you've added your test to tests/unit_node/timers_test.ts, you can run that file one of two ways:
- With cargo
this will execute all of the unit tests incargo test node_unit_tests::timers_testtimers_test.ts - You can also build deno with
cargo buildand then run the tests using the binary, so
that will run the tests with a normalcargo build ./target/debug/deno test -A --config tests/config/deno.json tests/unit_node/timers_test.tsdeno test, so you can filter specific tests within that file like you normally would
@nathanwhit I've moved the test to the appropriate directory, so the PR should be ready for merging. Please take a look when you can. Also, thanks for the tip about running directly from the target directory—it made things a lot easier!