Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

306
Vistas
Testing with TestBed: no Provider for StatusBar error

I've read the article about testing Ionic2 projects with TestBed and I've got the trouble when I'm trying to repeat example from article in my environment. When I try to start tests on Step 3 I have the error "No provider for StatusBar".

Probably it's a stupid question, but can somebody suppose why it happens?

StatusBar is included (imported) in my app.component.ts file.

import { StatusBar } from '@ionic-native/status-bar';
about 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

When using the TestBed, you are creating an entirely new @NgModule solely for testing. As such, you have to configure that test module to import all its dependencies - including, in your case, the status bar.

So, the same way you import the Status Bar in your main application (either directly or by importing its containing NgModule), you have to do the same for your test module.

TestBed.configureTestingModule({
  ......,
  providers: [
    StatusBar
  ]
})

or

 TestBed.configureTestingModule({
   imports: [
      ModuleContainingStatusBar
   ]     
})

(sorry, not familiar with Ionic itself so don't know how you import StatusBar for use)

about 4 years ago · Santiago Trujillo Denunciar

0

Try by adding it to the providers array of your @NgModule

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda