Angular Plotly test TypeError: Cannot read properties of undefined (reading 'data')
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- angular, plotly, typescript
Hướng nghiên cứu
Bắt đầu bằng cách chạy spec GraphComponent đang bị lỗi trong src/app/pages/graph.component.spec.ts và xem xét thiết lập PlotlyViaWindowModule. Truy vết lệnh gọi createFigure của PlotlyComponent trong ngOnDestroy, sử dụng stack trace được báo cáo làm điểm bắt đầu. Được xem là hoàn tất khi test hoàn thành mà không có TypeError, đồng thời component vẫn có thể sử dụng được với ng serve.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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();
});
- Ngôn ngữ chính
- TypeScript
- Star
- 242
- Fork
- 81
- Merge trung bình
- 8 giờ 48 phút
- Pull request đã merge (30 ngày)
- 18
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của plotly/angular-plotly.js
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
plotly/angular-plotly.js#285 · 3 bình luận ·
-
event handlers are not typed Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
plotly/angular-plotly.js#283 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
plotly/angular-plotly.js#281 · 8 bình luận · 2 reaction ·
-
Angular 19 specs won't run Đang mở
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
plotly/angular-plotly.js#278 · 2 bình luận · 1 reaction ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 38/100
plotly/angular-plotly.js#276 · 2 bình luận ·