| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Starting the long process of refactoring our own tests to use the node:test module and mocks.
| @@ -1,7 +1,7 @@ | |||
| // Flags: --no-warnings --expose-gc --expose-internals | |||
| // Flags: --expose-gc | |||
There was a problem hiding this comment.
I think we should add an eslint rule to avoid re-adding expose-internals to files that we avoid.
Sorry, something went wrong.
Not that I mind, but I'm curious what the motivation is for this? I'm assuming something related to Workers. |
Sorry, something went wrong.
Key motivation is make the tests more structured and easier to decompose... and yes, it's largely for other runtimes that want to be able to run/port the tests more easily in order to better verify Node.js compatibility. But it's also just good to have improved structure in our own tests just for us. |
Sorry, something went wrong.
To be honest, I think it goes in the opposite direction. Using BDD specific syntax does not help. |
Sorry, something went wrong.
As someone who has been working to port many of these tests to another runtime adding this kind of structure does help significantly. The current unstructured tests mix a number of public API, internal API, and test harness code in ways that make it difficult and time consuming to decompose or, often, to even know what exactly is being tested. Sure, the organization can be further improved but introducing some structure and organization is objectively better than having none, which is what we have now. |
Sorry, something went wrong.
As someone who has also ported many Node tests to another runtime, I can confirm that was a pain point for me at the time. |
Sorry, something went wrong.
Using node:test does not change that, it only add an additional module to the mix and a specific non portable test syntax. I think there is nothing better than a single file per test with no dependencies other than the strictly necessary ones. I said it elsewhere but I'll say it again. I have always loved the way tests were made and run in Node.js: a single script with no bullshit just like the minimal test cases we maintainers ask for bug reports. |
Sorry, something went wrong.
Not sure we'll agree on this point. Decomposing the tests into more structured units; going through the tests and relying, as much as possible, on public API surface (for instance, replacing common.mustCall(...) with mock.fn() checks); and having cleaner separation between things that are testing public API vs internal API helps significantly in porting these tests to other environments to ensure compatibility. Sure, the syntax isn't perfect but this absolutely helps the process along. |
Sorry, something went wrong.
Yes, I disagree. The common module is still required, so we actually end up duplicating/adding more code. |
Sorry, something went wrong.
Sorry, something went wrong.
Starting the long process of refactoring our own tests to use the node:test module and mocks. PR-URL: #54574 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Starting the long process of refactoring our own tests to use the node:test module and mocks. PR-URL: #54574 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
| Back | FazBrowse Home | New Git URL |
Starting the long process of refactoring our own tests to use the node:test module and mocks.
Also, splits the test that depends on internal API from the rest of the tests to make it easier to differentiate.