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
I'm dealing with a pretty strange error, and I was finally able to isolate and reproduce it on a minimal repository: https://github.com/hugoaboud/adonis-jest-mock-issue.
The repository README contains a complete description of the problem and files involved.
I'm able to mock class methods from node_modules and use them through my application without any problem.
However, if I use AdonisJS aliases, such as App/, the mock has no effect.
In short:
importControllerfrom"../app/Controller";// mock worksimportControllerfrom"App/Controller";// mock doesn't work
I assume this has to do with concurrency between Adonis IoC and Jest mock strategies. Do you have any thoughts?
There's an even simpler scenario, where the Service class doesn't belong to a dependency, but you import Controller with alias and Service without, or vice-versa:
I'm dealing with a pretty strange error, and I was finally able to isolate and reproduce it on a minimal repository: https://github.com/hugoaboud/adonis-jest-mock-issue.
The repository
README
contains a complete description of the problem and files involved.I'm able to mock class methods from node_modules and use them through my application without any problem.
However, if I use AdonisJS aliases, such as
App/
, the mock has no effect.In short:
I assume this has to do with concurrency between Adonis IoC and Jest mock strategies. Do you have any thoughts?
There's an even simpler scenario, where the
Service
class doesn't belong to a dependency, but you importController
with alias andService
without, or vice-versa:The text was updated successfully, but these errors were encountered: