-
Notifications
You must be signed in to change notification settings - Fork 621
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
fix(node): Enable native node tests #695
Conversation
This will implement https://github.com/Soremwar/deno_node_tests This is gonna be a big refactor, many tests won't be enabled as of now due to possible incompatibilities between the node lib and /std/node but luckily I designed the test script to be very configurable allowing to us to choose what tests to bring in |
Sorry I'm a bit confused about the purpose of this. Can you explain more what you had in mind? |
This will allow us to test std/node with the actual test suite the node folks use in their repo. This should help catch any implementation bugs or lack of features that the current library might have (I know for a fact this kind of inconsistencies are present in the Buffer implementation) |
I'm done for the night, I need to actually find some tests we can enable to start using this but it should be good to go for review |
BTW How should we handle the node license here? I can append the MIT license to the top of each file but IDK if that's enough |
Regarding license, you do not need to include the full text of the license at the top of each file, just a single line
|
Test suite functional and configurable, well documented and with the proper copyright headers. Big plus, I just set up the first test and catched the first implementation inconsistency (a static method inside EventEmitter) This is ready for review |
3c3a490
to
5a83358
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would prefer if this was more like regular tests and didn't require special steps to test.
WASI does this too with upstream tests but re-uses Deno.test.
|
||
To enable new tests, simply add a new entry inside `node/testdata/config.json` | ||
under the `tests` property. The structure this entries must have has to resemble | ||
a path inside `https://github.com/nodejs/node/tree/master/test`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you considered including Node as a git submodule? Is it too big?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A git submodule could suffice, but it makes it harder to patch some files that are needed for this to work, namely common/index.js
.
That file is used in pretty much every single file, however it uses things like child_process that are not needed in most cases, so instead I just patch it and all the tests that are enabled continue to use it without any trouble
Not to mention this is more user friendly than submodules :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about mocking common/index.js
by injecting a fake module into require.cache
, using a technique described here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That might be more complicated than the current solution though @kt3k
Tested locally. I was able to add test cases by adding items in config.json and running
BTW the directory name for these tools look a bit strange to me. I think we usually use |
I also tested it locally and it works. I'm in favor of this change. Nice work @Soremwar!
This also stood out to me. Non-fixture stuff should not be in testdata. |
|
Maybe node/_tools because it is internal? |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 😁
@Soremwar Thank you for your contribution! Merging. |
No description provided.