plotly / plotly/angular-plotly.js
Angular Plotly test TypeError: Cannot read properties of undefined (reading 'data')
オープン
まだ誰も着手していません。
- 主要言語
- TypeScript
- スター
- 242
- フォーク
- 81
- 平均マージ
- 8時間 48分
- マージ済み PR(30日)
- 18
説明
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();
});
コントリビューションガイド
このリポジトリのコントリビューションガイドは索引されていません
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず src/app/pages/graph.component.spec.ts にある失敗している GraphComponent spec を実行し、PlotlyViaWindowModule のセットアップを確認します。報告された stack trace を入口として、ngOnDestroy 中の PlotlyComponent の createFigure 呼び出しを追跡します。コンポーネントが ng serve で引き続き使用可能な状態で、TypeError なしにテストが完了すれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- angular, plotly, typescript
- 領域
- frontend, testing
- issue の種類
- バグ
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100