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

add stub implementation for node:dns #3169

Merged
merged 3 commits into from
Nov 25, 2024
Merged

Conversation

anonrig
Copy link
Member

@anonrig anonrig commented Nov 25, 2024

Implements a stub implementation for node:dns. Remember that there is still node:dns/promises that needs to be stubbed.

Small note: I'm in the process of investigating fully implementing node:dns in the short term.

@anonrig anonrig requested a review from jasnell November 25, 2024 16:26
@anonrig anonrig requested review from a team as code owners November 25, 2024 16:26
@anonrig anonrig requested a review from erikcorry November 25, 2024 16:26
strictEqual(typeof dns.reverse, 'function');
strictEqual(typeof dns.setDefaultResultOrder, 'function');
strictEqual(typeof dns.getDefaultResultOrder, 'function');
strictEqual(typeof dns.setServers, 'function');
Copy link
Member

Choose a reason for hiding this comment

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

A pattern like the following that also checks that the stub throws would likely be a bit easier, but non-blocking.

  ['lookup', 'lookupService', 'resolve', ...].forEach((i) => {
    strictEqual(typeof dns[i], 'function);
    throws(() => dns[i](...), { ... })
  });

src/workerd/api/node/dns.h Outdated Show resolved Hide resolved
anonrig and others added 2 commits November 25, 2024 12:22
Co-authored-by: James M Snell <jsnell@cloudflare.com>
@anonrig anonrig force-pushed the yagiz/add-stub-node-dns-impl branch from 86d3d3c to 7b2290f Compare November 25, 2024 19:43
@anonrig anonrig merged commit 0a67595 into main Nov 25, 2024
14 checks passed
@anonrig anonrig deleted the yagiz/add-stub-node-dns-impl branch November 25, 2024 19:59
danlapid pushed a commit that referenced this pull request Dec 3, 2024
* add stub implementation for node:dns

* Update src/workerd/api/node/dns.h

Co-authored-by: James M Snell <jsnell@cloudflare.com>

* simplify tests

---------

Co-authored-by: James M Snell <jsnell@cloudflare.com>
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.

2 participants