chore: Project review - #9
Merged
Merged
Conversation
- EDGEDRIVER_AUTO_INSTALL never fired on Windows: the postinstall entrypoint check hardcoded a forward slash (`/dist/install.js`), which never matches a backslash-separated argv[1]. Extracted into isAutoInstallEntrypoint(), using path.normalize/path.sep so it works cross-platform, matching geckodriver's existing equivalent. - downloadZip() had no protection against Zip Slip: a malicious zip entry (e.g. "../../evil.exe") could write outside the cache directory. Added the same path-containment guard geckodriver already has. Adds unit tests for both, following geckodriver's existing test patterns (mocked @zip.js/zip.js, fs/promises, hasAccess). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
unit.test.ts mixed tests for three unrelated modules (install.ts, utils.ts, index.ts) in one file, so the heavy install.ts mocking (fs/promises, @zip.js/zip.js, fetch) was inherited by the pure utils.ts tests for no reason. Split into install.test.ts, utils.test.ts, and index.test.ts, each carrying only the mocks it needs — matching geckodriver's existing convention of separate test files per concern. Also grouped extractBasicAuthFromUrl's 4 cases under a describe block, consistent with how every other multi-case function in this file is already organized. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
execFile's mock used .mockReturnValue({ kill: vi.fn() }), so every
call returned the exact same object — the kill mock's call count kept
accumulating across the whole file instead of resetting per test.
'can stop server' only passed because it happened to run last,
asserting the accumulated count of 5 rather than the 1 call it
actually intended to check; running it in isolation failed outright.
Switched to .mockImplementation() so each execFile() call gets its own
kill mock, and fixed the assertion to the correct toBeCalledTimes(1).
Also fixed an unrelated 'intance' -> 'instance' typo in the same test.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- removed the stale `vitest.config.ts` entry: that file was deleted from the repo at the very start of this project's cleanup (the monorepo uses vitest.config.mjs instead, already covered by the existing /*.mjs pattern), so this line had no effect - removed geckodriver's CHANGELOG.md exclusion, matching the npm ecosystem's default of shipping it (edgedriver/safaridriver don't exclude anything comparable either) - added *.tsbuildinfo: TypeScript's local incremental build cache was actually leaking into the published tarball (confirmed via `pnpm pack --dry-run`) since none of the existing patterns matched a non-dotfile like tsconfig.tsbuildinfo Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
Cleanup and hardening pass over the driver monorepo after the pnpm/TS6/oxlint migration.
/check)kill()mock was sharing one object across tests, masking a false-positive assertion; edgedriver's monolithicunit.test.tssplit by source module.npmignorealigned across all 3 packages — was leaking*.tsbuildinfointo published tarballs, verified viapnpm pack --dry-runFUNDING.yml,dependabot.yml,audit.yml,expense.yml) left over from when it was a standalone repo, now redundant at the monorepo level; added husky pre-commit/pre-push hookstypes.tscorrections in edgedriver/geckodriverNo behaviour change outside the two fixes above; everything else is test, packaging, or doc correctness.
🤖 Generated with Claude Code