Skip to content

Make WPAD and DHCP tests not reliant on NPM#126

Merged
nmoinvaz merged 4 commits intomasterfrom
mock-dhcp-wpad-tests
Feb 24, 2026
Merged

Make WPAD and DHCP tests not reliant on NPM#126
nmoinvaz merged 4 commits intomasterfrom
mock-dhcp-wpad-tests

Conversation

@nmoinvaz
Copy link
Collaborator

@nmoinvaz nmoinvaz commented Feb 23, 2026

I'm tired of all the npm security alerts for a testing framework.

@nmoinvaz nmoinvaz requested a review from sergio-nsk February 23, 2026 20:17
@nmoinvaz nmoinvaz added the unit tests Unit tests for testing framework label Feb 23, 2026
@nmoinvaz nmoinvaz force-pushed the mock-dhcp-wpad-tests branch 4 times, most recently from 985ce1a to c420d09 Compare February 23, 2026 21:23
@codecov-commenter
Copy link

codecov-commenter commented Feb 23, 2026

Codecov Report

❌ Patch coverage is 94.64789% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.83%. Comparing base (df114f1) to head (0bab71e).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
test/test_wpad_dns_fetch.cc 78.04% 6 Missing and 3 partials ⚠️
wpad_dns.c 85.48% 5 Missing and 4 partials ⚠️
test/test_wpad_dhcp.cc 99.37% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #126      +/-   ##
==========================================
+ Coverage   58.57%   63.83%   +5.26%     
==========================================
  Files          32       34       +2     
  Lines        2607     2912     +305     
  Branches      526      546      +20     
==========================================
+ Hits         1527     1859     +332     
+ Misses        745      707      -38     
- Partials      335      346      +11     
Flag Coverage Δ
macos 60.84% <94.64%> (+5.77%) ⬆️
macos_duktape 66.08% <94.64%> (+6.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR removes the Node/Yarn-based WPAD/DHCP test infrastructure and replaces it with native unit-testable helpers plus new GoogleTest coverage, aiming to eliminate NPM-related security alerts from CI while still validating WPAD behavior.

Changes:

  • Refactors WPAD DNS logic to generate candidate URLs via a helper (wpad_dns_get_urls) and adds a test-only fetch hook for deterministic unit tests.
  • Extracts DHCP parsing structures/constants into a private header and exposes selected helpers to tests via PROXYRES_TESTING / PROXYRES_TESTABLE.
  • Deletes Yarn/NPM test assets and updates CI workflows to run without Node (uses Python’s http.server).

Reviewed changes

Copilot reviewed 19 out of 20 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
wpad_dns.h Adds URL list + test hook APIs for WPAD DNS.
wpad_dns.c Implements URL generation/freeing and swaps DNS fetch loop to iterate generated URLs; adds test fetch indirection.
wpad_dhcp_posix_p.h New private header for DHCP message layout/constants and (test-only) helper declarations.
wpad_dhcp_posix.c Switches DHCP helper functions to PROXYRES_TESTABLE for unit testing and moves constants/types to the private header.
testing.h Introduces PROXYRES_TESTABLE macro to toggle internal helper visibility under tests.
test/yarn.lock Removes Yarn lockfile (Node dependency removal).
test/package.json Removes Node/Yarn dependency manifest.
test/http_server_cmd.js Removes Yarn/pm2-based HTTP server wrapper.
test/dhcp_server_cmd.js Removes Yarn/pm2-based DHCP server wrapper.
test/dhcp_server.js Removes Node-based DHCP server implementation.
test/test_wpad.cc Removes prior integration-style WPAD tests that depended on external environment/DHCP server.
test/test_wpad_dns.cc Adds unit tests for URL generation.
test/test_wpad_dns_fetch.cc Adds unit tests for DNS WPAD fetch iteration via injected fetch function.
test/test_wpad_dhcp.cc Adds unit tests for DHCP option parsing/building helpers.
test/CMakeLists.txt Registers new tests and enables PROXYRES_TESTING for the gtest target.
CMakeLists.txt Adds headers and enables PROXYRES_TESTING for the proxyres library when building tests.
.github/workflows/ubuntu.yaml Removes Node install; starts Python HTTP server; runs full test suite; changes triggers.
.github/workflows/macos.yaml Removes Node install; starts Python HTTP server; runs full test suite; changes triggers.
.github/workflows/win32.yaml Removes Node install; starts Python HTTP server; runs full test suite; changes triggers.
.github/workflows/winrt.yaml Changes triggers (no longer runs on push).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@sergio-nsk sergio-nsk left a comment

Choose a reason for hiding this comment

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

Additional comments to Copilot.

@nmoinvaz nmoinvaz force-pushed the mock-dhcp-wpad-tests branch from c420d09 to 987d5c7 Compare February 23, 2026 23:59
@nmoinvaz nmoinvaz force-pushed the mock-dhcp-wpad-tests branch 3 times, most recently from 8cb44d1 to 591b914 Compare February 24, 2026 00:22
@nmoinvaz nmoinvaz requested a review from Copilot February 24, 2026 00:24
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 19 out of 20 changed files in this pull request and generated 7 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@nmoinvaz nmoinvaz force-pushed the mock-dhcp-wpad-tests branch from 591b914 to 2b2935f Compare February 24, 2026 00:58
@nmoinvaz nmoinvaz force-pushed the mock-dhcp-wpad-tests branch from 55f1048 to 0bab71e Compare February 24, 2026 01:05
@nmoinvaz nmoinvaz merged commit c5b71b0 into master Feb 24, 2026
15 checks passed
@nmoinvaz nmoinvaz deleted the mock-dhcp-wpad-tests branch February 24, 2026 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

unit tests Unit tests for testing framework

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants