fix(vscode): relax @rstest/core version requirement#914
Conversation
Summary of ChangesHello @fi3ework, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines how the Rstest VS Code extension manages its dependency on the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Pull request overview
This PR relaxes the VS Code extension’s coupling to @rstest/core, introducing a minimum compatible core version check instead of requiring exact version equality, and adds unit tests around the new logic.
Changes:
- Add
MIN_CORE_VERSIONand semver-based version comparison helpers (shouldWarnCoreVersion,formatCoreVersionWarningMessage) inpackages/vscode/src/versionCheck.ts. - Update
packages/vscode/src/master.tsto log version mismatches at debug level and only show a user warning when the local@rstest/coreis below the minimum required version. - Add
semverand@types/semverdependencies and introduce focused unit tests inpackages/vscode/tests/unit/versionCheck.test.tsto validate version checking behavior, including prereleases and missing versions.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Locks new semver and @types/semver dependencies used for version checking in the VS Code extension package. |
| packages/vscode/package.json | Declares semver and @types/semver as dev dependencies for the extension, enabling typed semver comparisons. |
| packages/vscode/src/versionCheck.ts | Introduces a centralized minimum core version constant and semver-based helper functions for deciding when to warn and formatting the warning message. |
| packages/vscode/src/master.ts | Integrates the new version check: logs any core/extension version difference, and shows a warning only when @rstest/core is below MIN_CORE_VERSION, guarded to display at most once. |
| packages/vscode/tests/unit/versionCheck.test.ts | Adds unit tests that pin MIN_CORE_VERSION and verify shouldWarnCoreVersion semantics across lower/equal/higher and prerelease versions, plus the missing-version case. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request effectively addresses the strict version requirement for @rstest/core by introducing a more flexible minimum version check. The implementation is clean, with the new logic well-encapsulated in versionCheck.ts and backed by solid unit tests. This change will significantly improve the user experience for the VS Code extension. I have one suggestion to enhance type safety in the new versionCheck.ts file.
| export function formatCoreVersionWarningMessage(coreVersion?: string): string { | ||
| return `Rstest extension requires local @rstest/core >= ${MIN_CORE_VERSION}, but found ${coreVersion ?? 'unknown'}. Please upgrade @rstest/core.`; | ||
| } |
There was a problem hiding this comment.
The coreVersion parameter can be made non-optional. This function is only called from master.ts after shouldWarnCoreVersion(coreVersion) has returned true. The implementation of shouldWarnCoreVersion guarantees that coreVersion is a defined string in this scenario.
Changing the signature to formatCoreVersionWarningMessage(coreVersion: string) improves the function's contract and type safety. As a result, the nullish coalescing operator (?? 'unknown') is no longer needed.
| export function formatCoreVersionWarningMessage(coreVersion?: string): string { | |
| return `Rstest extension requires local @rstest/core >= ${MIN_CORE_VERSION}, but found ${coreVersion ?? 'unknown'}. Please upgrade @rstest/core.`; | |
| } | |
| export function formatCoreVersionWarningMessage(coreVersion: string): string { | |
| return `Rstest extension requires local @rstest/core >= ${MIN_CORE_VERSION}, but found ${coreVersion}. Please upgrade @rstest/core.`; | |
| } |
Summary
human input:
relax the annoying notification 😅.
@rstest/coreMIN_CORE_VERSION(initially0.6.0) as the manual compatibility baseline@rstest/coreversion is lower than the minimum requiredsemverdependency for robust version comparison and bundlingRelated Links
Checklist