Thanks to visit codestin.com
Credit goes to github.com

Skip to content

TestBed.overrideComponent doesn't update standalone components #48432

@satanTime

Description

@satanTime

Which @angular/* package(s) are the source of the bug?

core

Is this a regression?

No

Description

This removes imports - expected.

TestBed.overrideComponent(StandaloneComponent, {
  set: {
    imports: [],
  },
});

This doesn't change imports - unexpected.

TestBed.overrideComponent(StandaloneComponent, {
  set: {
    imports: [FakeTestingModule],
  },
});

There is stackblitz example - simply copy/paste the test.spec.ts to an angular v15 (v14 has his issue too) project.

Please provide a link to a minimal reproduction of the bug

https://github.com/satanTime/ng-mocks/blob/issues/4486/tests/issue-4486/angular.spec.ts

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

Angular CLI: 15.0.3
Node: 16.18.1
Package Manager: npm 8.19.3
OS: darwin x64

Angular: 15.0.3
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1500.3
@angular-devkit/build-angular   15.0.3
@angular-devkit/core            15.0.3
@angular-devkit/schematics      15.0.3
@schematics/angular             15.0.3
rxjs                            7.6.0
typescript                      4.8.4
webpack                         5.75.0

Anything else?

No response

Metadata

Metadata

Assignees

Labels

P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: testingIssues related to Angular testing features, such as TestBedbugcross-cutting: standaloneIssues related to the NgModule-less world

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions