test: move tanstack query tests to a separate folder#3825
Conversation
|
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
9dcb906 to
3dc2c36
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3825 +/- ##
=======================================
Coverage 39.57% 39.57%
=======================================
Files 532 532
Lines 19544 19544
Branches 5811 5811
=======================================
Hits 7734 7734
Misses 9568 9568
Partials 2242 2242
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
TL;DR — Extracts all TanStack Query plugin tests from the main test package into a dedicated Key changes
Summary | 2775 files | 1 commit | base: New TanStack Query test sub-package
The new package includes its own test infrastructure:
Test scenarios relocated from main
The relocated scenarios cover all six TanStack frameworks (
|
There was a problem hiding this comment.
Important
Two non-critical issues: a shallow getFilePaths that diverges from the shared recursive version, and a duplicated custom plugin test block.
Clean extraction overall — dependencies, vitest project registration, turbo override, and workspace inclusion all look correct. The custom plugin describe block being moved out of the version for loop in main/test/plugins.test.ts is a good fix (it was always testing 3.1.x input regardless of the loop variable).
Task list (5/5 completed)
- Checkout PR and read the diff
- Analyze major areas of change and high-risk areas
- Investigate changes in detail
- Self-critique and finalize comments
- Submit review
| function getFilePaths(output: string): string[] { | ||
| const dirPath = path.resolve(output); | ||
| if (!fs.existsSync(dirPath)) { | ||
| return []; | ||
| } | ||
|
|
||
| return fs.readdirSync(dirPath).flatMap((dirent) => { | ||
| const filePath = path.join(dirPath, dirent); | ||
| if (fs.statSync(filePath).isDirectory()) { | ||
| return fs.readdirSync(filePath).map((file) => path.join(filePath, file)); | ||
| } | ||
| return [filePath]; | ||
| }); | ||
| } |
There was a problem hiding this comment.
This inline getFilePaths only traverses 2 levels deep (top-level entries + one subdirectory), while every other test package — including plugins.test.ts and meta-function.test.ts in this same directory — imports the shared fully-recursive getFilePaths from ../../../utils. The shallow version could silently miss files if the output structure ever nests deeper than 2 levels.
Consider importing from the shared utility instead:
import { getFilePaths } from '../../../utils';The same applies to 3.1.x.test.ts.
| } | ||
|
|
||
| describe('custom plugin', () => { | ||
| it('handles a custom plugin', async () => { | ||
| const myPlugin: DefinePlugin<{ | ||
| customOption: boolean; | ||
| name: any; | ||
| }>['Config'] = { | ||
| api: undefined, | ||
| config: { | ||
| customOption: true, | ||
| }, | ||
| dependencies: ['@hey-api/typescript'], | ||
| handler: vi.fn(), | ||
| name: 'my-plugin', | ||
| }; | ||
|
|
||
| await createClient({ | ||
| input: path.join(getSpecsPath(), '3.1.x', 'full.yaml'), | ||
| logs: { | ||
| level: 'silent', | ||
| }, | ||
| output: path.join(__dirname, 'generated', 'my-plugin', 'default'), | ||
| plugins: [myPlugin, '@hey-api/client-fetch'], | ||
| }); | ||
|
|
||
| expect(myPlugin.handler).toHaveBeenCalled(); | ||
| }); | ||
|
|
||
| it.skip('throws on invalid dependency', async () => { | ||
| const myPlugin: DefinePlugin<{ | ||
| name: any; | ||
| }>['Config'] = { | ||
| api: undefined, | ||
| config: {}, | ||
| dependencies: ['@hey-api/oops'], | ||
| handler: vi.fn(), | ||
| name: 'my-plugin', | ||
| }; | ||
|
|
||
| await expect(() => | ||
| createClient({ | ||
| input: path.join(getSpecsPath(), '3.1.x', 'full.yaml'), | ||
| logs: { | ||
| level: 'silent', | ||
| }, | ||
| output: path.join(__dirname, 'generated', 'my-plugin', 'default'), | ||
| plugins: [myPlugin, '@hey-api/client-fetch'], | ||
| }), | ||
| ).rejects.toThrowError(/Found 1 configuration error./g); | ||
|
|
||
| expect(myPlugin.handler).not.toHaveBeenCalled(); | ||
| }); | ||
| }); |
There was a problem hiding this comment.
This custom plugin describe block is identical to the one in main/test/plugins.test.ts (lines 231–282). These tests exercise the generic DefinePlugin API — they have no TanStack Query dependency — so they'll now run in both vitest projects. Consider keeping them only in main and removing them from here to avoid the duplication.
|
TL;DR — Extracts all TanStack Query v5 plugin tests and their snapshots from the monolithic Key changes
Summary | 1399 files | 1 commit | base: TanStack Query tests extracted to standalone workspace
The new package includes a
|
There was a problem hiding this comment.
Incremental changes are lockfile-only (adds axios to the tanstack-query/v5 package and deduplicates lockfile entries). No new issues.
Task list (5/5 completed)
- Checkout PR and read the diff
- Analyze major areas of change and high-risk areas
- Investigate changes in detail
- Self-critique and finalize comments
- Submit review
3dc2c36 to
26bb72b
Compare
26bb72b to
e8a6e44
Compare
e8a6e44 to
6c76116
Compare
6c76116 to
c7a136f
Compare
|
@pullfrog can you figure out why the Windows test suddenly fails and fix it? |
|
The Windows CI failure was caused by Task list (5/5 completed)
|

No description provided.