Conversation
All file patterns were simple extension checks (e.g. **/*.js), so minimatch can be replaced with path.extname() and a Set of allowed extensions. This removes an external dependency with no behavior change.
Extract isSupportedFile helper that skips path segments starting with "." (replicating minimatch's default dot:false) and deduplicates the filter logic between the PR and push code paths.
The yaml package has built-in TypeScript types and a cleaner API, removing the need for the separate @types/js-yaml package.
Use undici's MockAgent to intercept fetch requests in tests, aligning mocks with the actual HTTP stack used by Node's native fetch.
undici is available as a Node 24 built-in; installing it as a package caused ncc to bundle v7 into dist/index.js, nearly doubling its size.
There was a problem hiding this comment.
Pull request overview
Refactors the test HTTP mocking layer to use Undici’s MockAgent instead of nock, aligning request interception with Node’s native fetch stack and removing nock-related dependencies.
Changes:
- Replaced
nockusage in linter tests withundiciMockAgentinterceptors. - Removed
nock/@types/nockfrom devDependencies and pruned lockfile entries. - Cleaned up duplicate dotfile exclusion tests in
gittest suite.
Reviewed changes
Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
yarn.lock |
Removes nock and its transitive dependencies from the lockfile. |
package.json |
Drops nock and @types/nock from devDependencies. |
src/linter.test.ts |
Migrates HTTP mocking from nock to Undici MockAgent + interceptors. |
src/git.test.ts |
Removes duplicate test cases around dotfile/dot-directory exclusion. |
Comments suppressed due to low confidence (1)
package.json:35
undiciis imported/used in this test file but it isn't declared inpackage.jsondependencies/devDependencies. Relying on a transitive/hoistedundiciinstall (currently present inyarn.lock) can break in different package managers or after dependency graph changes. Addundicias an explicit devDependency (and keep the lockfile updated accordingly).
"devDependencies": {
"@eslint/js": "^9.20.0",
"@types/mocha": "^10.0.10",
"@types/node": "^24",
"@types/sinon": "^17.0.3",
"@vercel/ncc": "^0.38.3",
"c8": "^10.1.3",
"eslint": "^9.20.0",
"eslint-plugin-mocha": "^10.5.0",
"husky": "^9.1.7",
"lint-staged": "^15.4.3",
"mocha": "^11.1.0",
"prettier": "^3.4.2",
"rimraf": "^6.0.1",
"sinon": "^19.0.2",
"ts-node": "^10.9.2",
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Capture the original Undici dispatcher before installing MockAgent and restore it in afterEach to prevent a closed dispatcher from leaking into subsequent tests.
| assert.ok(!result.includes('test.')) | ||
| }) | ||
|
|
||
| it('should exclude dotfiles', async () => { |
There was a problem hiding this comment.
Are these tests no longer needed? They seem unrelated to the undici change
There was a problem hiding this comment.
They are duplicates. Because of how Claude did the changes internally, it basically split things into multiple histories. This PR was actually not created off the previous one (even though my state locally was to do so.)
If you expand down further, you will see the tests are still there, the corrected forms from #103 .
Summary
nockwithundici'sMockAgentfor HTTP request interception in testsfetchnockand@types/nockdependenciesTest plan
No QA Required