New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature(testing): add 'provideTranslocoTestingModule' or export its injection tokens. #710
Comments
We are also facing problems after the update to transloco v5/v6. We are also having a custom function which returns the Now we are getting Our testing module factory function looks like this at the moment:
|
@MikeDabrowski Would maybe something like this work for you to have additional providers on the module?
@krechtern We had the same issue - turns out we had not imported |
Is there an existing issue for this?
Which Transloco package(s) will this feature affect?
Transloco
Is your feature request related to a problem? Please describe
In out app we use transloco + locale + messageFormat. We had to make some units that test those features so we have
This worked fine in v4 but upgrading it now to v5 and v6 presents some issues.
In v5+ default way of enabling transloco is using provider fns. But for test there stil is the testing module .forRoot. As you can see we used to import 3 modules, 2 of which are now moved to provider fns. The end goal here is to have a one line that can be used in TestBed's imports (or providers). So Custom testing module idea was born:
The providers are mostly copied from source of translocoTestingModule.
However the problem now is - how to get the TRANSLOCO_TEST_LANGS and TRANSLOCO_TEST_OPTIONS
Describe the solution you'd like
At this point I am not sure what would help here.
Option 1
Would be to export the TRANSLOCO_TEST_LANGS, TRANSLOCO_TEST_OPTIONS and perhaps something else.
I tried manually adding exports in built packages but it failed with
Option 2
Would be to provide provider function for that translocoTesting module and add a way to provide additional providers.
Option 3
Do this in each place
Describe alternatives you've considered
Additional context
No response
I would like to make a pull request for this feature
No
The text was updated successfully, but these errors were encountered: