Skip to content

Document how to test hybrid apps that include angular.js components #24369

@jpzwarte

Description

@jpzwarte

I'm submitting a...


[ ] Regression (a behavior that used to work and stopped working in a new release)
[x] Bug report  
[ ] Performance issue
[ ] Feature request
[x] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
[ ] Other... Please describe:

Current behavior

After upgrading an angular.js component and then making it available using downgradeComponent from @angular/upgrade/static, my angular.js karma test fails with:

Error: [$injector:unpr] Unknown provider: $$angularLazyModuleRefProvider <- $$angularLazyModuleRef

I'm not using a custom karma config. I'm just using the one generated by the angular-cli.

The upgrade guide at https://angular.io/guide/upgrade does not go into what you need to do to get tests running again when you have a hybrid application. It only covers upgrading the tests to angular. SO and Google are no help in this case.

Expected behavior

It should not fail and the docs should cover this scenario.

Minimal reproduction of the problem with instructions

This is my compatibility module for angular.js which is a dependency for the module i'm loading in my jasmine test (ng.mock.module):

export const compatModule = ng
  .module('compat', [])
  .directive('voPageFooter', downgradeComponent({ component: PageFooterComponent }) as ng.IDirectiveFactory)
  .directive('voPageHeader', downgradeComponent({ component: PageHeaderComponent }) as ng.IDirectiveFactory)
  .factory('ngZone', downgradeInjectable(NgZone));

What is the motivation / use case for changing the behavior?

Environment


Angular version: 6.0.2
Angular.js version: 1.6.9

Metadata

Metadata

Assignees

No one assigned

    Labels

    P4A relatively minor issue that is not relevant to core functionsarea: docsRelated to the documentationarea: upgradeIssues related to AngularJS → Angular upgrade APIsfeatureIssue that requests a new featurefeature: under considerationFeature request for which voting has completed and the request is now under considerationfeature: votes requiredFeature request which is currently still in the voting phasefreq3: highstate: needs eng input

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions