-
Notifications
You must be signed in to change notification settings - Fork 8
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
Fixed an issue where espower-babel/guess didn't work when required in gulpfile.js #24
Conversation
Fixed an issue preventing espower-babel/guess require hook from working when it's invoked by outside of mocha cli, such as gulpfile.js or test/*.js.
// <extension>:espower-babel/guess | ||
var args = arg.split(':'); | ||
if (args.length <= 1) { | ||
if (!~arg.indexOf(':')) { |
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.
It should be arg.indexOf(':') === -1
.
Fixed the mentioned point and added a test. |
The added test has failed due to the timeout, while in my computer it wasn't failed. |
@@ -0,0 +1,15 @@ | |||
/** |
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.
Is gulpfile.js
required on top(root) directory?
Can you move it to test/issues/24
dir?
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.
Oh, sorry for that, sure.
@@ -22,7 +22,7 @@ | |||
"lib" | |||
], | |||
"scripts": { | |||
"test": "mocha --require './guess' test/**/*.js && mocha --require './test_loader/espower-traceur-loader' test/**/*.js && mocha test/issues/17 --compilers es6:./guess" | |||
"test": "mocha --require './guess' test/**/*.js && mocha --require './test_loader/espower-traceur-loader' test/**/*.js && mocha test/issues/17 --compilers es6:./guess && mocha test/issues/24 --compilers js:./guess --timeout 5000" |
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.
--timeout 15000
🆙 ❓
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.
✓ can run a task whose name contains a colon (7445ms)
☑️
|
Fixed an issue where espower-babel/guess didn't work when required in gulpfile.js
@nodaguti OK. Thank for work. |
Release 4.0.1 |
I found that Node.js 0.12 is very slow. |
Overview
This PR fixes an issue where process.argv sniffing prevented the require hook from working under certain envs by making the sniffing more strict and accurate.
The issue details
When espower-babel/guess require hook was invoked by a process with an argument containing ':', guess.js failed to
require.resolve()
and threw an error.For example, when I executed the following command, it ended with the following error message.
Command line
gulpfile.babel.js
Error message