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
Allow all configuration options of livereload to be passed through. #246
Conversation
CHANGELOG
Outdated
@@ -1,3 +1,7 @@ | |||
v1.1.0: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please leave all version changes to the person who will make the release if this is merged.
f7d862d
to
1b2f13f
Compare
520f07b
to
d856f0e
Compare
@aknrdureegaesr Can you reduce duplication a bit? Also can you add a test? |
d856f0e
to
50bf15d
Compare
I have been looking for the test to augment by temporarily introducing a bug in the existing passing of the parameters:
When I run Is there any other way to run tests, or does a test that tests parameter passing simply not exist presently? |
The tests are here grunt-contrib-connect/test/connect_test.js Lines 193 to 218 in 9da2f37
You could add a new test there, pass your options and check if the port/hostname etc match. |
There are three code branches:
The redundant |
Yeah, but still, it's duplication. |
Yes, I've seen those tests. Those tests do not test whether the number passed as a port is actually used, so they test something, but not parameter handover. I take your answer as "tests that test parameter passing do not presently exist". I'll see what I can do. |
The way to avoid it I can think of is something like
Seems to me that cure is worse than the disease. What do you think? |
OK, let's forget about the deduplication, but please try to add a test. |
50bf15d
to
5cdf2d6
Compare
Done. |
docs/connect-options.md
Outdated
|
||
*This does not perform live reloading. It is intended to be used in tandem with grunt-contrib-watch or another task that will trigger a live reload server upon files changing.* | ||
If you set to `true`, defaults are used. If you set to a number, that number is used as a port number, together with the hostname you configured. If you set this to a map, that map is passed to `connect-livereload` unchanged as its configuration. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
map -> object
5cdf2d6
to
f320a47
Compare
So, @aknrdureegaesr, thanks for the patience so far! Now, I was wondering, the 2 tests you added do seem indentical in the objects you are passing. Do we need them to be like that or should we test for different things? |
At this point, we have three cases: Livereload is simply true, or is a number, or is an object. The possibility to add an object is new. The other two configuration options existed before. As I found out, there was no previous test for the "number" case. There was only a test on the "true" case. So I added that missing test for the previously-existing "number" functionality. And I also added a test for my own work. So we now have three tests instead of one. But... I am not so sure the previously existing functionality is actually useable. At least on my machine, in a real-world example, both variants (true and number) kept producing a script URI along the lines of It might be worth a consideration to simply remove the old "true" and the old "port" configuration. There is nothing you could do with those that you couldn't do with the full way, that my patch introduces. But it might break compatibility for people who have been using the old way and for whom that worked. I'm not sure whether such people exist or don't. Those people would have to re-configure. In short: To reduce code and tests, we could remove the two old ways, "true" and number, and only keep my new way. I'd be happy to reduce the code in that way. What do you think, is better? Small, or compatible? |
Let's keep the changes to the minimum here and you can always make a new PR to improve tests later. |
…xOf" with -1." This reverts commit f320a47.
Allow all livereload configuration options to be passed through.
Fixes #100