Skip to content

chore: Project review - #9

Merged
dprevost-LMI merged 7 commits into
webdriverio:mainfrom
dprevost-LMI:project-review
Sep 21, 2026
Merged

dprevost-LMI merged 7 commits into
webdriverio:mainfrom
dprevost-LMI:project-review

Conversation

@dprevost-LMI

@dprevost-LMI dprevost-LMI commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Cleanup and hardening pass over the driver monorepo after the pnpm/TS6/oxlint migration.

  • Security fix: Zip Slip guard in edgedriver's zip extraction, plus a Windows path bug that broke auto-install detection (backslash paths never matched the hardcoded / check)
  • Test fixes: safaridriver's kill() mock was sharing one object across tests, masking a false-positive assertion; edgedriver's monolithic unit.test.ts split by source module
  • Packaging fix: .npmignore aligned across all 3 packages — was leaking *.tsbuildinfo into published tarballs, verified via pnpm pack --dry-run
  • Repo cleanup: removed safaridriver's stale per-package GitHub config (FUNDING.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 hooks
  • Docs/types: README grammar and code-sample fixes (root + all 3 packages), small types.ts corrections in edgedriver/geckodriver

No behaviour change outside the two fixes above; everything else is test, packaging, or doc correctness.

🤖 Generated with Claude Code

dprevost-LMI and others added 7 commits September 20, 2026 22:31
- 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>
@dprevost-LMI
dprevost-LMI merged commit 8331115 into webdriverio:main Sep 21, 2026
6 checks passed
@dprevost-LMI
dprevost-LMI deleted the project-review branch September 21, 2026 11:06
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.

1 participant