Tabbed Ionic 3: Error cleaning component

I have an error at the end of each of my tests (with success or failure) regarding tabs in ionic 3.

It seems to come from an element <ion-tabs></ion-tabs>in my tabs.html, because when I commented on it, the error went away.

I also can not use fixture.destroy();in my test, it shows this error:

TypeError: Unable to read property 'unregisterChildNav' from null

There are nothing more than the generated basic tabs of the ion project, by this command: ionic start myApp tabs

I just added a spec for tabs.

If this can help, below is my spec code:

import { TestBed, ComponentFixture, async } from '@angular/core/testing'; 
import { By } from '@angular/platform-browser'; 
import { DebugElement } from '@angular/core'; 
import { IonicModule } from 'ionic-angular';

import { MyApp } from '../../app/app.component'; import { TabsPage } from './tabs';

// import { ViewControllerMock } from '../../mocks';

let comp: TabsPage; 
let fixture: ComponentFixture<TabsPage>; 
let de: DebugElement; 
let deArray: DebugElement[]; 
let el: HTMLElement;

describe('Page: Tabs', () => {

  beforeEach(async(() => {

    TestBed.configureTestingModule({

      declarations: [MyApp, TabsPage],

      providers: [
      ],

      imports: [
        IonicModule.forRoot(MyApp)
      ]

    }).compileComponents();

  }));

  beforeEach(() => {

    fixture = TestBed.createComponent(TabsPage);
    comp    = fixture.componentInstance;
    // fixture.detectChanges();

  });

  afterEach(() => {

    // fixture.destroy();

    comp = null;
    de = null;
    el = null;   });

  it('should be created', () => {

    expect(fixture).toBeTruthy();
    expect(comp).toBeTruthy();

  });

  it ('should have 4 tabs', () => {

    deArray = fixture.debugElement.queryAll(By.css('ion-tabs ion-tab'));

    expect(deArray.length).toBe(4);

  });
});

Hope someone can help me :)

+4

Source: https://habr.com/ru/post/1677774/