Skip to content
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

new config option "absolutePaths", new exposed method "getReplacement", update README #42

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

cape-dev
Copy link
Contributor

Hi jwalton,

first of all thank you for the recent collaboration on requireish. It was really fun and productive ;)

I wanted to implement the new functionality in my project and faced new problems. I generally think, that it is not a good idea to replace the aliases with relative paths. There is no argument against replacing them always with absolute ones.

This was very crucial when I tried to use proxyquierifywith aliasify. Let me explain the scenario:
With proxyquireify you are able to stub out arbitrary required modules. The problem here is... If you require a module through an alias in the original file which gehts replaced through a relative path from aliasify you are not longer able to stub out this package because the require path for that module was manipulated and can not longer be stubbed out with the alias.

Here comes a second problem in play. There is no method to manually get the replacement for an alias. I have to programmatically get the replacement path for the alias I want to stub out what is now possible with the new method getReplacement.

Now the absolute paths are important because the stubbed out path in the proxyquireify stubs has to match the replaced require path in the original file. This is nearly impossible if you have your spec files in a completely different folder than your src files.

Last but not least I updated the README with the new functionalities and edited the requireish part which was not exactly correct.

@coveralls
Copy link

coveralls commented May 26, 2016

Coverage Status

Coverage decreased (-0.5%) to 94.444% when pulling 244575d on kamekazemaster:master into bbeb4f2 on benbria:master.

@cape-dev
Copy link
Contributor Author

It would be nice if the function would look for the config automatically. But i don't know how to accomplish that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants