otter
otter copied to clipboard
[Bug]: Warning Multiple pipes match the name `date` while using a date + translate pipe in a component for the unit tests
Package name
localization
Package version
10.2.16
Reproduction steps
Create a component and use both the date and the translate pipes in the template of this component Implement the UT file for this component with the proper imports, providers and declaration Write whatever test and try to run it
NOTE: we are using jest on which we have added https://www.npmjs.com/package/jest-fail-on-console in the setup-jest.ts. This will make the UT fails as soon as something is logged in the console.
Current result
A warning is raised, and due to the use of jest-fail-on-console then the tests are failing. We could deactivate it (or ignore for console.warn) but we would rather not.
Expected result
No multiple date pipe warning.
Additional comments
This seems coming from the use of mockTranslationModules (https://github.com/AmadeusITGroup/otter/blob/9b7c439f0d4c098f18919d1264dff7d7db88cb66/packages/%40o3r/testing/src/localization/localization-mock.ts#L56) which imports the LocalizationModule (https://github.com/AmadeusITGroup/otter/blob/9b7c439f0d4c098f18919d1264dff7d7db88cb66/packages/%40o3r/localization/src/tools/localization.module.ts) and the LocalizationModule is overriding the DatePipe.