Angular Plotly test TypeError: Cannot read properties of undefined (reading 'data')
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 3/5
- 預估耗時
- 1-2 天
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- angular, plotly, typescript
研究方向
首先執行 src/app/pages/graph.component.spec.ts 中失敗的 GraphComponent spec,並檢查 PlotlyViaWindowModule 的設定。以回報的 stack trace 作為入口,追蹤 ngOnDestroy 期間 PlotlyComponent 的 createFigure 呼叫。當測試在沒有 TypeError 的情況下完成,且元件仍可透過 ng serve 使用時,即表示完成。
由索引模型根據 Issue 內容生成。
描述
i am having an issue running the tests file for my page
TypeError: Cannot read properties of undefined (reading 'data')
TypeError: Cannot read properties of undefined (reading 'data')
at PlotlyComponent.createFigure (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-plotly.js/__ivy_ngcc__/fesm2015/angular-plotly.js.js:285:21)
at PlotlyComponent.call [as ngOnDestroy] (http://localhost:9876/_karma_webpack_/webpack:/node_modules/angular-plotly.js/__ivy_ngcc__/fesm2015/angular-plotly.js.js:195:29)
at executeOnDestroys (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6537:32)
at cleanUpView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6438:9)
at destroyViewTree (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6264:21)
at destroyLView (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:6416:9)
at RootViewRef.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:13512:9)
at ComponentRef.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/core.mjs:13958:23)
at ComponentFixture.destroy (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm2015/testing.mjs:228:31)
at UserContext.<anonymous> (http://localhost:9876/_karma_webpack_/webpack:/src/app/pages/graph.component.spec.ts:163:17)
i am using PlotlyViaWindowModule, when i start ng serve the plot is working correctly without any issues but i cant run the test
describe('GraphComponent', () => {
let component: GraphComponent;
let fixture: ComponentFixture<GraphComponent>;
let debugElement: DebugElement;
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [... , PlotlyComponent], providers: [...PlotlyService, { provide: MyPlotService, useClass: myPlotServiceMock},
], imports: [
...
PlotlyViaWindowModule,]
beforeEach(() => {
fixture = TestBed.createComponent(GraphComponent);
component = fixture.componentInstance;
debugElement = fixture.debugElement;
fixture.detectChanges();
});
it('shoud create the app', () => {
expect(component).toBeTruthy();
});
- 主要語言
- TypeScript
- 星號
- 242
- 分支
- 81
- 平均合併
- 23 小時 52 分鐘
- 30 天內合併 PR
- 5
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
plotly/angular-plotly.js 的其他 Issue
-
難度 2/5 1-3 小時 新手友好度 76/100
plotly/angular-plotly.js#373 ·
維護者通常 1 天內回覆
-
Feature request: please add migration guide可能已有人在做 @andrefarzat 於 21 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 45/100
plotly/angular-plotly.js#285 · 3 則留言 ·
維護者通常 1 天內回覆
-
event handlers are not typed可能已有人在做 @andrefarzat 於 21 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 38/100
plotly/angular-plotly.js#283 ·
維護者通常 1 天內回覆
-
Angular 20 standalone application可能已有人在做 @andrefarzat 於 21 天前認領。 未關閉
難度 3/5 1-2 天 新手友好度 35/100
plotly/angular-plotly.js#281 · 8 則留言 · 2 個 reaction ·
維護者通常 1 天內回覆
-
難度 3/5 1-2 天 新手友好度 25/100
plotly/angular-plotly.js#278 · 2 則留言 · 1 個 reaction ·
維護者通常 1 天內回覆
查看 plotly/angular-plotly.js 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 66/100
riverqueue/river#1576 ·
維護者通常 1 天內回覆
-
[bug] A prompt queued during a run is assessed without its text可能已有人在做 @jwiegley 今天認領。 未關閉
難度 2/5 1-3 小時 新手友好度 72/100
DevMortimer/pi-warden#211 ·
維護者通常 1 天內回覆
-
enhancement
難度 1/5 1 小時以內 新手友好度 84/100
mattermost/compass-design#191 ·
維護者通常 1 天內回覆
-
Add unit tests for the organization admin role check可能已有人在做 @SaffuSafwan 今天認領。 未關閉area/core good first issue help wanted
難度 1/5 1 小時以內 新手友好度 90/100
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 62/100
HorusGoul/trizum#559 · 1 則留言 ·
維護者通常 1 天內回覆