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

fix: util.parseArgs() missing node:process import #22405

Merged
merged 1 commit into from
Feb 18, 2024

Conversation

javihernant
Copy link
Contributor

fix parseArgs() not working due to missing import of node:process

this commit fixes issue #22363

@CLAassistant
Copy link

CLAassistant commented Feb 13, 2024

CLA assistant check
All committers have signed the CLA.

@mmastrac
Copy link
Contributor

This looks good, but can you try enabling the test-parse-args.mjs test by removing the line in tests/node_compat/config.jsonc?

See the notes in tools/node_compat/TODO.md for more info on what to do to update the test config files.

@javihernant
Copy link
Contributor Author

Removing the line? You mean adding it? It is already there. I wonder, if the test was already there, how come it has never failed?

@mmastrac
Copy link
Contributor

mmastrac commented Feb 14, 2024

That file is a list of ignored tests, so removing it will run it

Oops! @kt3k corrected me below.

@kt3k
Copy link
Member

kt3k commented Feb 14, 2024

@mmastrac @javihernant tests/node_compat/config.jsonc includes both ignore-list and include-list (root.ignore is for ignoring and root.test is for including). The test file test-parse-args.mjs is included and the test cases in it actually are passing.

You can check it with the command:

./target/debug/deno test --config tests/node_compat/deno.json -A tests/node_compat/test.ts -- test-parse-args.mjs

The fixed code path (the case when args option is omitted) doesn't seem tested in the compat test case.

I think we need to add our own test case in tests/unit_node/util_test.ts to exercise this fix.

@javihernant
Copy link
Contributor Author

okay! Im going to try creating a custom test

Deno.test({
name: "[util] parseArgs() with no args works",
fn() {
util.parseArgs();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks causing a type error. I think we need to pass an empty object

Suggested change
util.parseArgs();
util.parseArgs({});

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, that was the problem. I've fixed it in my fork. I've seen the CI test that fails is run with cargo test. However, that takes a lot of time to run in my machine. What's the most appropriate way I should be running tests? I've used previously the ./target/debug/deno test --config tests/config/deno.json -A tests/unit_node/util_test.ts command, which run only the tests of my PR. However, that didn't check for TS syntax error it seems.

fix parseArgs() not working due to missing import of node:process

this commit fixes issue denoland#22363
Copy link
Member

@kt3k kt3k left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Nice work!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants