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
getModule does not search the packageDirectories in sfdx-project.json in the order I would expect. If we have a project that has two components with the same name, the resolver will return the path to the first component based on the ascending order in packageDirectories. However, when we push the source to an org, the last component defined in packageDirectories will overwrite the first one. I would expect the sfdx-lwc-jest resolver to behave in the same way.
Steps to Reproduce
Setup an sfdx-project.json with at least two packageDirectories
Create two components with the same name in each package directory. When the project is pushed, the component in force-app-wip will overwrite the other because it is defined after force-app in packageDirectories.
Write a jest test that imports the component using the default namespace.
import MyComponent from 'c/myComponent';
Expected Results
The imported component will be the one defined in force-app-wip.
Actual Results
The imported component is the version defined in force-app.
Version
@salesforce/sfdx-lwc-jest: 0.14.0
Node: 14.2.0
Possible Solution
If we scan the packageDirectories in reverse order, the correct component will be resolved first.
Description
getModule
does not search thepackageDirectories
insfdx-project.json
in the order I would expect. If we have a project that has two components with the same name, the resolver will return the path to the first component based on the ascending order inpackageDirectories
. However, when we push the source to an org, the last component defined inpackageDirectories
will overwrite the first one. I would expect thesfdx-lwc-jest
resolver to behave in the same way.Steps to Reproduce
Setup an
sfdx-project.json
with at least twopackageDirectories
Create two components with the same name in each package directory. When the project is pushed, the component in
force-app-wip
will overwrite the other because it is defined afterforce-app
inpackageDirectories
.Write a jest test that imports the component using the default namespace.
Expected Results
The imported component will be the one defined in
force-app-wip
.Actual Results
The imported component is the version defined in
force-app
.Version
Possible Solution
If we scan the
packageDirectories
in reverse order, the correct component will be resolved first.The text was updated successfully, but these errors were encountered: