Current behavior
The bug is obvious:
|
const { providers, ...configRest } = config |
|
|
|
const componentFixture = createComponentFixture(component) as Type<T> |
|
|
|
TestBed.configureTestingModule({ |
|
...bootstrapModule(componentFixture, configRest), |
|
}) |
|
|
|
if (providers != null) { |
|
TestBed.overrideComponent(componentFixture, { |
|
add: { |
|
providers, |
|
}, |
|
}) |
|
} |
The providers that are meant to be added to the TestingModule are instead only added in a call to TestBed.overrideComponent(). This way, it is not possible to alter dependencies of singleton services aka services that are { providedIn: 'root' } (or any custom module).
Desired behavior
Passed providers must be passed to TestBed.configureTestingModule()
Test code to reproduce
Irrelevant. See source code snippet above.
Cypress Version
10.6.0
Node version
irrelevant
Operating System
irrelevant
Debug Logs
No response
Other
No response
Current behavior
The bug is obvious:
cypress/npm/angular/src/mount.ts
Lines 143 to 157 in d201b37
The providers that are meant to be added to the TestingModule are instead only added in a call to
TestBed.overrideComponent(). This way, it is not possible to alter dependencies of singleton services aka services that are{ providedIn: 'root' }(or any custom module).Desired behavior
Passed providers must be passed to
TestBed.configureTestingModule()Test code to reproduce
Irrelevant. See source code snippet above.
Cypress Version
10.6.0
Node version
irrelevant
Operating System
irrelevant
Debug Logs
No response
Other
No response