Reputation: 1
I'm in the process of upgrading our Angular application from version 18 to 19. Angular 19 now marks all components, directives, and pipes as standalone by default. Since we’re not ready to migrate our entire codebase to the new standalone paradigm, we're using non-standalone components in our tests.
However, when I run the tests, I encounter the following error:
Error: Unexpected "MockOfTranslatePipe" found in the "declarations" array of the "MockOfTranslateModule" NgModule, "MockOfTranslatePipe" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead?
In my tests, I mock the TranslatePipe from @ngx-translate/core using ng-mocks. I configured the global default in our test file as follows:
ngMocks.config({
defaultStandalone: false,
});
However, when I run the tests, I still encounter the following error:
Error: Unexpected "MockOfTranslatePipe" found in the "declarations" array of the "MockOfTranslateModule" NgModule, "MockOfTranslatePipe" is marked as standalone and can't be declared in any NgModule - did you intend to import it instead?
My questions are:
Any help or guidance on how to proceed with this migration would be greatly appreciated!
Upvotes: 0
Views: 46