new config option "absolutePaths", new exposed method "getReplacement", update README #42
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
proxyquierify
withaliasify
. 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 fromaliasify
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.