-
-
Notifications
You must be signed in to change notification settings - Fork 3
fix(vitest): resolve module aliasing, dependency compatibility, and coverage generation for v4 #132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- Updated discord-api-types from ^0.37.115 to ^0.38.16 to fix enum compatibility issues - Rewrote vitest.config.ts to use custom plugin for Node.js subpath imports (#lib, #utils, etc.) - Added explicit environment and pool configuration for better stability - Removed vite-tsconfig-paths dependency (not needed) Co-authored-by: RedStar071 <[email protected]>
Co-authored-by: RedStar071 <[email protected]>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
@copilot fix two worflows |
- Add explicit provider: 'v8' in coverage config - Add reportsDirectory: './coverage' for explicit output location - Add reportOnFailure: true to ensure coverage reports are generated even when tests fail - Remove singleFork configuration that may have caused issues Co-authored-by: RedStar071 <[email protected]>
Fixed! The workflows were failing because Vitest v4 changed the default behavior: Coverage generation issue: By default in v4, coverage reports aren't generated when tests fail. Added Configuration updates:
The cobertura-coverage.xml file now generates correctly for the Codecov upload step in continuous-integration.yml. Commit: 1a4f9b1 Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR updates the discord-api-types dependency from version 0.37.115 to 0.38.16 and makes related adjustments to support the new API types. It also refactors the Vitest configuration for better path resolution and re-enables the donate button in the info command.
- Update
discord-api-typesto version 0.38.16 with improved type definitions - Refactor Vitest configuration to use a custom plugin for subpath import resolution
- Re-enable the donate button component in the info command
Reviewed Changes
Copilot reviewed 6 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| package.json | Updated discord-api-types dependency to ^0.38.16 in both dependencies and resolutions |
| yarn.lock | Updated lockfile entries for the new discord-api-types version |
| src/commands/General/info.ts | Replaced deprecated APIMessageActionRowComponent with APIButtonComponent type and re-enabled donate button |
| tests/lib/bits.test.ts | Added 'PinMessages' permission to test expectations to match new API types |
| src/commands/Tools/avatar.ts | Added type assertion for VALID_SIZES array includes check |
| vitest.config.ts | Refactored from resolve aliases to custom plugin for handling Node.js subpath imports with improved configuration options |
| .vscode/settings.json | Added TypeScript SDK path configuration |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| private resolveSize(parameter: string): ImageSize { | ||
| const size = Number(parameter) as ImageSize; | ||
| if (Number.isNaN(size) || !VALID_SIZES.includes(size)) return 2048; | ||
| if (Number.isNaN(size) || !VALID_SIZES.includes(size as ImageSize)) return 2048; |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The type assertion as ImageSize is redundant here. The variable size is already typed as ImageSize on line 34, so casting it again when passing to .includes() is unnecessary. The original code without the extra cast should work fine with TypeScript.
| if (Number.isNaN(size) || !VALID_SIZES.includes(size as ImageSize)) return 2048; | |
| if (Number.isNaN(size) || !VALID_SIZES.includes(size)) return 2048; |
| "**/.git/": true | ||
| } | ||
| }, | ||
| "typescript.tsdk": "node_modules\\typescript\\lib" |
Copilot
AI
Nov 8, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The path separator used here is Windows-specific (\\). For cross-platform compatibility, this should use forward slashes (/) or node_modules/typescript/lib, which works on all platforms including Windows.
| "typescript.tsdk": "node_modules\\typescript\\lib" | |
| "typescript.tsdk": "node_modules/typescript/lib" |
Vitest v4 broke module resolution for Node.js subpath imports (#lib, #utils, etc.), exposed a discord-api-types version mismatch causing enum initialization failures, and changed coverage generation behavior breaking CI workflows.
Changes
Module Resolution
Dependencies
Test Configuration
Coverage Configuration
provider: 'v8'for coverage collectionreportsDirectory: './coverage'for consistent output locationreportOnFailure: trueto ensure coverage reports are generated even when tests fail (critical for CI workflows)Test suite: 280/281 passing (1 pre-existing failure unrelated to upgrade)
Coverage reports (cobertura, lcov) now generate correctly for CI workflows.
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.