You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When accidentally mocking a provider dependency with MockBuilder using .keep() or .mock() instead of .provide(), I get the following mysterious and uninformative error message:
Error: MockBuilder has found a missing dependency: Object. It means no module provides it. Please, use the "export" flag if you want to add it explicitly. https://ng-mocks.sudo.eu/api/MockBuilder#export-flag
An example of the bug
For example, try providing ActivatedRoute with the .keep():
Test fails to run with a helpful error message, such as:
Error: A provider object has been incorrectly passed to the MockerBuilder.keep() method. Did you mean to use MockerBuilder.provide()?
Actual behavior
Test fails to run with the following error message, which is not helpful (e.g., adding keep(Object, {export: true} still fails).
Error: MockBuilder has found a missing dependency: Object. It means no module provides it. Please, use the "export" flag if you want to add it explicitly. https://ng-mocks.sudo.eu/api/MockBuilder#export-flag
The text was updated successfully, but these errors were encountered:
Description of the bug
When accidentally mocking a provider dependency with
MockBuilder
using.keep()
or.mock()
instead of.provide()
, I get the following mysterious and uninformative error message:An example of the bug
For example, try providing
ActivatedRoute
with the.keep()
:The test fails with the error:
MockBuilder has found a missing dependency: Object.
Changing
.keep()
to.provide()
fixes the problem:Link: https://stackblitz.com/edit/github-hzu37y?file=src%2Ftest.spec.ts
Expected vs actual behavior
Expected behavior
Test fails to run with a helpful error message, such as:
Actual behavior
Test fails to run with the following error message, which is not helpful (e.g., adding
keep(Object, {export: true}
still fails).The text was updated successfully, but these errors were encountered: