Skip to content

fix(lint): resolve mocked modules on Windows - #1935

Open
soyorin33 wants to merge 1 commit into
Tencent:mainfrom
soyorin33:fix/mock-source-windows-paths
Open

soyorin33 wants to merge 1 commit into
Tencent:mainfrom
soyorin33:fix/mock-source-windows-paths

Conversation

@soyorin33

Copy link
Copy Markdown

Summary

On Windows, teamai/mock-source silently misses mocks of modules that only re-export another module. lintedPath returns a drive-qualified path, but path.posix.resolve treats it as relative, so the rule looks for a nonexistent source file.

Use native path operations to locate the mocked file and resolve relative re-exports. Normalize the suggested module specifier to forward slashes.

Type of Change

  • Bug fix (lint rule only)

Test Plan

Verified on native Windows with Node 22.19.0 and Git 2.51.0.windows.1, based on df433c61.

  • node node_modules/vitest/vitest.mjs run oxlint-plugin-teamai/rules/mock-source.test.ts --retry 0: 7 failed / 4 passed before the fix; 11 passed after it. The existing cases cover vi.mock, vi.doMock, extensionless and directory imports, named re-exports, relative suggestions, and allowed mocks.
  • npm run typecheck — passed.
  • node node_modules/oxlint/bin/oxlint --type-aware --deny-warnings --report-unused-disable-directives oxlint-plugin-teamai/rules/mock-source.js — passed.
  • git diff --check — passed.
  • npm run lint — blocked by 26 teamai/family-facts diagnostics, also reproduced on unmodified df433c61 on this host. That separate Windows issue is covered by fix(lint): resolve family facts imports on Windows #1927.
  • node scripts/check-docs.mjs — reports three driver-guide mismatches (Paseo, sandbox, T3), identically on the baseline and this branch.

Full-suite and POSIX execution are left to CI. This lint-rule-only change does not require a real-CLI world run under the contribution guidelines.

Notes for Reviewers

One file, two changed lines. Existing tests supply the regression proof, including the forward-slash suggestion. The rule applies to linted tests independently of tool, driver, install scope, team mode, delivery layer, or run state. No existing docs or runtime skill guidance needs updating.

Prepared with Codex assistance for discovery, implementation, verification, and this description.

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.

2 participants