Skip to content
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

fix custom comiler file (absolute path) support in windows system #2329

Merged
merged 2 commits into from Jul 1, 2016
Merged

fix custom comiler file (absolute path) support in windows system #2329

merged 2 commits into from Jul 1, 2016

Conversation

silentcloud
Copy link
Contributor

@silentcloud silentcloud commented Jun 24, 2016

mocha --compilers js:C:\User\fortest\demo\compiler.js

#2310

@boneskull
Copy link
Member

@silentcloud thanks!

var compiler = c.split(':')
, ext = compiler[0]
, mod = compiler[1];
var compiler = c.match(/([a-z.]+):(([A-Z]:)?\S*)+/)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are several problems with this regular expression--instead, try c.split(':', 1). does that work?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boneskull

var str = 'js:C:\\Users\\fortest\\example\\compiler.js';
console.log(str.split(':', 1))
//['js']

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right, it still splits, just doesn't return it. how about just:

var idx = c.indexOf(':');
var ext = c.slice(0, idx);
var mod = c.slice(idx + 1);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"slice" is better, I will update this PR

@ScottFreeCode
Copy link
Contributor

Looks good to me.

@silentcloud
Copy link
Contributor Author

@boneskull merge & publish a version ?

@boneskull boneskull merged commit ea71b44 into mochajs:master Jul 1, 2016
@boneskull
Copy link
Member

@silentcloud not sure when the release will be but I can merge this. thanks again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants