PR on issue #742 withLocalConfig - basic tests & implementation#748
PR on issue #742 withLocalConfig - basic tests & implementation#748SBoudrias merged 4 commits intoyeoman:masterfrom gruppjo:issue-742-withConfig
Conversation
|
👍 //cc @SBoudrias |
|
👍 |
|
Hey @gruppjo, thanks for the PR. This look mostly good. The only thing is I think we should create a |
|
Thanks for your feedback!
Since the generator isn't run until later and calling |
|
I don't want us to call any method on the generator. Let's not make any assumption on the inner working of the generator, let's just create the environment it's going to use externally. That's why I want to create the |
|
Thank you for your input! Just to make sure I understand this correctly: The However I have a concern: when manually creating the You'd have to pass in the generator's name as well. Which I think is a little counter intuitive, isn't it? This feels a little bloated (implementation & usage) to me. What do you think? |
|
Hi, I was able to do some more work on this (sorry for the two separate commits, I was in a bit of a hurry). The code now creates a I'm not so sure about this one... Let me know what you think. |
|
Hey @gruppjo I've rethought this over and I think your first solution calling Mind reverting your changes to use your first solution? |
|
@SBoudrias, I absolutely don't mind :) I'll get to it as soon as possible! |
|
I reverted the changes, but not using git revert but by creating a new commit. Is that ok? |
|
Looks like a build error, I restarted them and it's passing. |
PR on issue #742 withLocalConfig - basic tests & implementation
|
👍 great! |
As discussed on issue #742 I created a PR:
Here's what I've done so far:
test/run-context.js
write unit test for
withLocalConfig()methodlib/test/helpers.js
write a
mockLocalConfig()function, that uses the generator's store'sdefault()method to provide the config. This seemed an easy way to implement it, however I'm not sure whether it's a good idea to do so.lib/tests/run-context.js
extend the
RunContextconstructor, its_run()method and added awithLocalConfig()method to put everything together.Notice how
helper.mockLocalConfig()only gets called whenwithLocalConfig()was called? I needed to restrict this, since otherwise one of the tests would try to create a.yo-rc.jsonin/(root directory) and obviously would fail (I don't know why this happens though...).Please let me know what you think.