Skip to content

content: Ionic Angular Testing (Standalone etc) #3808

Closed

Description

@studioromeo

URL

https://ionicframework.com/docs/angular/testing

Issue Description

We are in dire need of some documentation on how to test ionic in angular.

The current documentation explains the theory behind testing but does not go into ionic specifics. I'd argue that the theory behind what is a unit test has been covered elsewhere in more detail and so it's not important for the ionic docs to go over that.

What we could use is knowing how to correctly bootstrap ionic so that components are loaded correctly and can be tested. I know theres some nuances due to ionics web component architecture. Some of it is explained on stencil docs and elsewhere.

While I've been able to figure out some things through looking the ionic source code and also a bit of blind luck there are some things I haven't been able to determine yet. For example when testing a standalone project it's not clear how to bootstrap ionic in testbed or whether its required at all? Using provideIonicAngular() doesn't seem to render any components but importing IonicModule does (but only if calling forRoot).

TestBed.configureTestingModule({
      providers: [
        importProvidersFrom(IonicModule.forRoot()), <<< - works but is this right?
        provideIonicAngular({}), // does not render but is more alike to real world
      ],
    }).compileComponents()

But there are issues with using IonicModule.forRoot as described here ionic-team/ionic-framework#23173 (comment) hence why standalone is a good idea but these components don't seem to render?

Any advice is helpful on this to point us in the right direction 🙏

Activity

  1. added
    content
    on Dec 31, 2024
  2. added
    package: angular
    on Dec 31, 2024
  3. thetaPC commented on Aug 7, 2026

    @thetaPC
    Contributor

    Thank you for the issue! The section can be viewed now!

  4. added a commit that references this issue on Aug 8, 2026
    52829ef
  5. added a commit that references this issue on Aug 20, 2026
    3018264
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contentpackage: angular

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions