Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR updates test utilities and refreshes dependencies for v7 maintenance, ensuring more reliable file matching and HTTP server simulation in tests.
- Added stricter
globbyoptions inextra.test.jsto limit matches to actual files and avoid symlinks. - Introduced an in-process TCP server helper and
get-portincli.test.jsfor better isolation of HTTP-based tests. - Bumped dev/prod dependencies and test scripts in
package.json.
Reviewed Changes
Copilot reviewed 3 out of 10 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| test/extra.test.js | Added onlyFiles, cwd, and followSymbolicLinks to globby call. |
| test/cli.test.js | Implemented getServer helper with net and get-port; updated tests to use it. |
| package.json | Refactored test script, added test:unit, and bumped various deps. |
Comments suppressed due to low confidence (1)
test/cli.test.js:120
- The
outresult from$is usually an object withstdout/stderr; usingtoString()may not capture just the stdout. Useout.stdout.toString()(orout.toString()if that’s guaranteed) to explicitly match the correct output stream.
assert.match(out.toString(), /test/)
| let out = await $`node build/cli.js http://127.0.0.1:8081`.nothrow() | ||
| assert.match(out.stderr, "Error: Can't get") | ||
| const port = await getPort() | ||
| const server = await getServer(['HTTP/1.1 500\n\n']).listen(port) |
There was a problem hiding this comment.
You're calling the built-in listen method instead of the custom start helper, so the promise-based start logic isn't being used. Change .listen(port) to .start(port) to ensure the server is ready before proceeding.
Suggested change
| const server = await getServer(['HTTP/1.1 500\n\n']).listen(port) | |
| const server = await getServer(['HTTP/1.1 500\n\n']).start(port) |
antonmedv
approved these changes
Jun 23, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.