Flaky tests in WSL2(Windows 11, Ubuntu20.04) #8163
Send to my agentDescribe the bug#
I ran pnpm run test three times
- https://cloud.nx.app/runs/ILyyfwTp5P
- https://cloud.nx.app/runs/czXaFeTO7e
- https://cloud.nx.app/runs/aTK8nfP6pU
And I encountered some failures, which is flaky It doesn't seem to fail every time
Failed : nx run @tanstack/react-query-next-experimental:test:types (Failed 2 out of 3 times)
> @tanstack/react-query-next-experimental@5.59.8 test:types /home/cho/tanstack/query/packages/react-query-next-experimental
> pnpm run "/^test:types:ts[0-9]{2}$/"
. test:types:ts50$ node ../../node_modules/typescript50/lib/tsc.js
. test:types:ts51$ node ../../node_modules/typescript51/lib/tsc.js
. test:types:ts52$ node ../../node_modules/typescript52/lib/tsc.js
. test:types:ts53$ tsc
. test:types:ts53: src/HydrationStreamProvider.tsx(3,26): error TS7016: Could not find a declaration file for module '@tanstack/react-query'. '/home/cho/tanstack/query/packages/react-query/build/modern/index.js' implicitly has an 'any' type.
. test:types:ts53: Try `npm i --save-dev @types/tanstack__react-query` if it exists or add a new declaration (.d.ts) file containing `declare module '@tanstack/react-query';`
. test:types:ts53: src/ReactQueryStreamedHydration.tsx(9,8): error TS7016: Could not find a declaration file for module '@tanstack/react-query'. '/home/cho/tanstack/query/packages/react-query/build/modern/index.js' implicitly has an 'any' type.
. test:types:ts53: Try `npm i --save-dev @types/tanstack__react-query` if it exists or add a new declaration (.d.ts) file containing `declare module '@tanstack/react-query';`
. test:types:ts53: src/ReactQueryStreamedHydration.tsx(18,8): error TS7016: Could not find a declaration file for module '@tanstack/react-query'. '/home/cho/tanstack/query/packages/react-query/build/modern/index.js' implicitly has an 'any' type.
. test:types:ts53: Try `npm i --save-dev @types/tanstack__react-query` if it exists or add a new declaration (.d.ts) file containing `declare module '@tanstack/react-query';`
. test:types:ts53: src/ReactQueryStreamedHydration.tsx(47,44): error TS7006: Parameter 'event' implicitly has an 'any' type.
. test:types:ts53: src/ReactQueryStreamedHydration.tsx(71,32): error TS7006: Parameter 'query' implicitly has an 'any' type.
. test:types:ts53: Failed
ELIFECYCLE Command failed with exit code 2.
ELIFECYCLE Command failed with exit code 2.
Failed: nx run @tanstack/react-query-next-experimental:test:types (Failed 2 out of 3 times)
> @tanstack/query-example-nextjs-suspense-streaming@ test:types /home/cho/tanstack/query/examples/react/nextjs-suspense-streaming
> tsc
error TS6053: File '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/.next/types/app/api/wait/route.ts' not found.
The file is in the program because:
Matched by include pattern '.next/types/**/*.ts' in '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/tsconfig.json'
error TS6053: File '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/.next/types/app/layout.ts' not found.
The file is in the program because:
Matched by include pattern '.next/types/**/*.ts' in '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/tsconfig.json'
error TS6053: File '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/.next/types/app/page.ts' not found.
The file is in the program because:
Matched by include pattern '.next/types/**/*.ts' in '/home/cho/tanstack/query/examples/react/nextjs-suspense-streaming/tsconfig.json'
ELIFECYCLE Command failed with exit code 2.
Failed: nx run @tanstack/react-query:test:lib (Failed 1 out of 3 times)
> @tanstack/react-query@5.59.8 test:lib /home/cho/tanstack/query/packages/react-query
> vitest
Testing types with tsc and vue-tsc is an experimental feature.
Breaking changes might not follow SemVer, please pin Vitest's version when using it.
RUN v2.0.5 /home/cho/tanstack/query/packages/react-query
Coverage enabled with istanbul
✓ |@tanstack/react-query| src/__tests__/queryOptions.test-d.tsx (19 tests)
✓ |@tanstack/react-query| src/__tests__/infiniteQueryOptions.test-d.tsx (13 tests)
✓ |@tanstack/react-query| src/__tests__/useInfiniteQuery.test-d.tsx (8 tests)
✓ |@tanstack/react-query| src/__tests__/useQueries.test-d.tsx (6 tests)
✓ |@tanstack/react-query| src/__tests__/useQuery.test-d.tsx (9 tests)
✓ |@tanstack/react-query| src/__tests__/useSuspenseQueries.test-d.tsx (6 tests)
✓ |@tanstack/react-query| src/__tests__/suspense.test-d.tsx (9 tests)
✓ |@tanstack/react-query| src/__tests__/prefetch.test-d.tsx (5 tests)
✓ |@tanstack/react-query| src/__tests__/useQuery.test.tsx (155 tests) 18136ms
✓ |@tanstack/react-query| src/__tests__/useInfiniteQuery.test.tsx (27 tests) 4133ms
✓ |@tanstack/react-query| src/__tests__/useQueries.test.tsx (21 tests) 1238ms
stdout | src/__tests__/suspense.test.tsx > useSuspenseQueries > should show error boundary even with gcTime:0 (#7853)
queryFn
✓ |@tanstack/react-query| src/__tests__/suspense.test.tsx (23 tests) 11511ms
✓ |@tanstack/react-query| src/__tests__/useMutation.test.tsx (23 tests) 3410ms
✓ |@tanstack/react-query| src/__tests__/QueryResetErrorBoundary.test.tsx (13 tests) 3308ms
✓ |@tanstack/react-query| src/__tests__/prefetch.test.tsx (9 tests) 2950ms
✓ |@tanstack/react-query| src/__tests__/HydrationBoundary.test.tsx (7 tests) 951ms
✓ |@tanstack/react-query| src/__tests__/ssr-hydration.test.tsx (3 tests) 394ms
❯ |@tanstack/react-query| src/__tests__/useMutationState.test.tsx (7 tests | 1 failed) 2306ms
× useIsMutating > should return the number of fetching mutations
→ expected [ +0, 1, 2, +0 ] to deeply equal [ +0, 1, 2, 1, +0 ]
Ignored nodes: comments, script, style
<html>
<head />
<body>
<div>
<div />
</div>
</body>
</html>
✓ |@tanstack/react-query| src/__tests__/useIsFetching.test.tsx (5 tests) 812ms
✓ |@tanstack/react-query| src/__tests__/useSuspenseQueries.test.tsx (6 tests) 903ms
✓ |@tanstack/react-query| src/__tests__/fine-grained-persister.test.tsx (3 tests) 754ms
✓ |@tanstack/react-query| src/__tests__/ssr.test.tsx (5 tests) 177ms
✓ |@tanstack/react-query| src/__tests__/QueryClientProvider.test.tsx (4 tests) 465ms
⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
FAIL |@tanstack/react-query| src/__tests__/useMutationState.test.tsx > useIsMutating > should return the number of fetching mutations
AssertionError: expected [ +0, 1, 2, +0 ] to deeply equal [ +0, 1, 2, 1, +0 ]
Ignored nodes: comments, script, style
<html>
<head />
<body>
<div>
<div />
</div>
</body>
</html>
- Expected
+ Received
Array [
0,
1,
2,
- 1,
0,
]
❯ src/__tests__/useMutationState.test.tsx:62:49
60|
61| renderWithClient(queryClient, <Page />)
62| await waitFor(() => expect(isMutatingArray).toEqual([0, 1, 2, 1, 0…
| ^
63| })
64|
❯ runWithExpensiveErrorDiagnosticsDisabled ../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/config.js:47:12
❯ checkCallback ../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/wait-for.js:124:77
❯ Timeout.checkRealTimersCallback ../../node_modules/.pnpm/@testing-library+dom@10.4.0/node_modules/@testing-library/dom/dist/wait-for.js:118:16
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
Test Files 1 failed | 22 passed (23)
Tests 1 failed | 385 passed (386)
Type Errors no errors
Start at 20:45:21
Duration 178.99s (transform 9.12s, setup 29.77s, collect 15.64s, tests 51.45s, environment 51.97s, prepare 11.67s, typecheck 23.04s)
ELIFECYCLE Command failed with exit code 1.
Your minimal, reproducible example#
Sorry but this is test failure in local environment
Steps to reproduce#
pnpm install > pnpm build:all > pnpm run test
Expected behavior#
All of the tests passed
How often does this bug happen?#
None
Screenshots or Videos#
No response
Platform#
Windows 11, using WSL2 (Ubuntu 20.04) pnpm version 9.12.1 node version 20.10.0
Tanstack Query adapter#
None
TanStack Query version#
v5.59.8
TypeScript version#
v5.3.3
Additional context#
On macOS all tests passed, but on WSL2 (Ubuntu20.04, Windows11) some tests failed. It seemed flaky, and I just wanted to point it out Thanks
TkDodo closed this
TkDodo added labelswontfix
Sign in to join this conversation.
the
useMutationState.testfrom the second run has been stabilized in a different PR.type failures are no flakiness, it just means something hasn’t been built yet. Not sure what that can be as I’ve never seen it before.