Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

Weird bug with Angular unit tests

已關閉
#10,046 4 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

維護者通常 1 天內回覆

@benjavicente 已經在處理了。

開始於 2026年10月2日。

  • #10779 來自 @raashish1601 —— 已關閉,未合併
  • #11178 來自 @yogesh968 —— 已關閉,未合併

評估

難度
4/5
預估耗時
3-5 天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
需要釐清
活躍度
停滯
技術堆疊
angular, typescript

研究方向

使用 ng test 在連結的最小範例中重現該行為,比較註解掉和未註解掉類別欄位行時的 app.ts。首先追蹤 Angular adapter 中的 fixture.whenStable() 和 query.data。當理解該行為,且預期結果已由一個聚焦的測試涵蓋時,即表示完成。

由索引模型根據 Issue 內容生成。

描述

package: angular-query
Describe the bug

In the docs it says that in the unit tests we should await fixture.whenStable() so a query completes and we get its resulted data. It is true but if I add a class field that references to query.data the query's data becomes undefined.

Your minimal, reproducible example

https://github.com/ms-dosx86/test-when-stable

Steps to reproduce
  1. Run ng test
  2. See that the test passes
  3. Uncomment the commented line in app.ts
  4. Run the test again
  5. Test fails
Expected behavior

I'm not sure what's going on there but I have a feeling that creating a class field that references to query.data shouldn't cause such behaviour.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform
  • MacOS 26.0.1 (25A362)
  • Chrome 143.0.7499.193
Tanstack Query adapter

angular-query

TanStack Query version

5.90.22

TypeScript version

5.8.2

Additional context

No response

主要語言
TypeScript
星號
50.5k
分支
4.2k
平均合併
8 小時 14 分鐘
30 天內合併 PR
632

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

TanStack/query 的其他 Issue

查看 TanStack/query 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。