Skip to content
This repository was archived by the owner on Jul 29, 2024. It is now read-only.
This repository was archived by the owner on Jul 29, 2024. It is now read-only.

Automatically detect hybrid apps most of the time #3836

Closed
@sjelin

Description

@sjelin

Before the ng12Hybrid flag, our wait logic was as follows:

if (window.getAngularTestability) {
  // We are in an ng2 app and should use ng2 testability
} else {
  // We are in an ng1 app and should use ng1 testability
}

This causes problems because sometimes, but not consistently, the ngUpgrade API would publish both testability APIs, causing us to use the ng2 testability API, but really we wanted the ng1 testability API (which is what you use in hybrid apps). So we introduced the ng12Hybrid flag to resolve this ambiguity. But was it really ambiguous? Instead we should have just reversed the original logic:

if (window.angular && !(window.angular.version && window.angular.version.major > 1)) {
  // We are in either an ng1 app or an ngUpgrade app and should use ng1 testability
} else {
  // We are in an ng2 app and should use ng2 testability
}

I propose we do the following:

  • In master, if ng12Hybrid is not set, used the new check (which makes ng12Hybrid needless)
  • In beta, rebase the above change in and then remove the ng12Hybrid flag entierly

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions