-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
switch from Node v5.x.x to Node v6.x.x #250
Conversation
@@ -60,6 +60,6 @@ setup: | |||
test: | |||
$(ISTANBUL) cover node_modules/.bin/_mocha -- --recursive --timeout 10000 | |||
$(ISTANBUL) check-coverage --branches 100 | |||
ifneq ($(shell node --version | sed 's/[.][^.]*$$//'),v0.10) | |||
ifeq ($(shell node --version | cut -d . -f 1),v6) |
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.
Perhaps this belongs in the issue, but (assuming makefiles have a concept of else), it might be appropriate to place a message here? That way, a contributor will realise if doctests didn't run and they may need to fix something before opening a PR
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.
Very good idea! I'll make a change so that a warning message is emitted in the else
branch. :)
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.
Updated. See below. Sample output:
⚠️ Doctests are only run in Node v6.x.x (current version is v4.5.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.
Great! I often run in a terminal without escape code support, but the string of escape codes would at least draw my attention :)
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.
Good point. It doesn't print properly in the CircleCI logs either. I'll use colour codes instead:
$ echo $'\e[33m\e[7mWARN\e[27m Doctests are only run in Node v6.x.x (current version is '"$(node --version)"$')\e[0m'
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.
My primary environment (currently) doesn't actually support any escape codes, but I still think they're a good idea here. (If you were very worried about this, you could have a $TERM=dumb
check)
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.
After some trial and error, I think I have a version which will do the right thing in most environments:
- If
$(TERM)
isdumb
,$(patsubst dumb,,$(TERM))
will evaluate to empty string; otherwise it will evaluate to the value of$(TERM)
(which may be empty string). $(if $(patsubst dumb,,$(TERM)),\033[33m\033[7mWARN\033[27m,[WARN])
will evaluate to[WARN]
if the value of$(TERM)
isdumb
(or empty string);\033[33m\033[7mWARN\033[27m
otherwise.33m
sets the foreground colour to yellow,7m
switches foreground and background colours, and27m
undoes the switch.- This appears inside a
$''
string, but since$
has special meaning in a makefile we must escape it with an extra dollar sign.
@rjmk, would you mind sanity checking the line below? There's no doubt we're overengineering this, but I believe the only cost is the time I've spent fiddling (which I've quite enjoyed).
One can test this by commenting out lines 61 and 62 then running make test
and TERM=dumb make test
. CircleCI is happy now too.
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.
Makes sense to me!
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.
Actually, I decided to restrict myself to ASCII regardless of environment. I had too much trouble getting CircleCI to do the right thing. Also, I'm now redirecting the output to stderr.
👍 |
000e1d9
to
406c255
Compare
406c255
to
8046e60
Compare
This addresses the test failure noted in #248.
As can be seen in the diff, we currently have a guard which prevents doctests from being run in Node v0.10.x (which doesn't support arrow functions). It's completely reasonable to run doctests in just one environment, since their purpose is to keep the documentation up to date rather than guarantee compatibility across Node versions. I suggest the latest stable version if we're to choose just one.
I hope these changes obviate the need to mention a version in CONTRIBUTING.md, as it would be easy for such a note to become out of date. Let's merge this pull request then discuss in #248 whether to add a note.