Angular Plotly test TypeError: Cannot read properties of undefined (reading 'data')
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 35/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Ferma
- Stack tecnologico
- angular, plotly, typescript
Direzione di ricerca
Inizia eseguendo lo spec fallito di GraphComponent in src/app/pages/graph.component.spec.ts e controlla la configurazione di PlotlyViaWindowModule. Traccia la chiamata a createFigure di PlotlyComponent durante ngOnDestroy, usando lo stack trace riportato come punto di ingresso. Il lavoro è completato quando il test termina senza TypeError mentre il componente rimane utilizzabile con ng serve.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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();
});
- Lingua principale
- TypeScript
- Stelle
- 242
- Fork
- 81
- Merge medio
- 8h 48m
- PR unite (30g)
- 18
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di plotly/angular-plotly.js
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
plotly/angular-plotly.js#285 · 3 commenti ·
-
event handlers are not typed Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
plotly/angular-plotly.js#283 ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 35/100
plotly/angular-plotly.js#281 · 8 commenti · 2 reazioni ·
-
Angular 19 specs won't run Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 25/100
plotly/angular-plotly.js#278 · 2 commenti · 1 reazione ·
-
Difficoltà 3/5 1-2 giorni Idoneità per principianti 38/100
plotly/angular-plotly.js#276 · 2 commenti ·