-
Notifications
You must be signed in to change notification settings - Fork 23
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
Have multiple CWDs for each pattern #37
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
module.exports = function(){return 'a thing'} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -158,6 +158,46 @@ describe('remapify', function(){ | |
}]) | ||
}) | ||
|
||
it('looks for files in multiple directories, in precedence', function(done){ | ||
b.on('remapify:files', function(files, expandedAliases){ | ||
expandedAliases.should.contain.keys( | ||
'a.js', | ||
'b.js' | ||
) | ||
expandedAliases['a.js'].split(path.sep).join('/').should.equal('./test/fixtures/target2/a.js') | ||
expandedAliases['b.js'].split(path.sep).join('/').should.equal('./test/fixtures/target/b.js') | ||
|
||
b.emit.should.not.have.been.calledWith('error') | ||
|
||
done() | ||
}) | ||
|
||
plugin(b, [{ | ||
src: '**/*.js' | ||
, cwd: ['./test/fixtures/target2', './test/fixtures/target'] | ||
}]) | ||
}) | ||
|
||
it('multiple cwds works when passing in an array from command line', function(done){ | ||
b.on('remapify:files', function(files, expandedAliases){ | ||
expandedAliases.should.contain.keys( | ||
'a.js', | ||
'b.js' | ||
) | ||
expandedAliases['a.js'].split(path.sep).join('/').should.equal('./test/fixtures/target2/a.js') | ||
expandedAliases['b.js'].split(path.sep).join('/').should.equal('./test/fixtures/target/b.js') | ||
|
||
b.emit.should.not.have.been.calledWith('error') | ||
|
||
done() | ||
}) | ||
|
||
plugin(b, [{ | ||
src: '**/*.js' | ||
, cwd: {'_': ['./test/fixtures/target2', './test/fixtures/target'] } | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm… I thought the ideal here was an array for There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it does accept an array, but I'm also accepting a map with one key. This is because browserify seems to call remapify with the above arguments, if called as follows from the command line:
I have no idea if this is documented to work like this, or if it's random, but it does this consistently. Thus we accept 4 types of arguments for cwd
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Huh. That's gotta be coming from minimist, and is likely a bug in browserify. You might want to submit an issue there and reference that in the code comment. If we're going to support this hack, mind adding a test that shows that just an array works too? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There actually is a test. It's in the previous commit? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. haha – my bad. Sorry! |
||
}]) | ||
}) | ||
|
||
it('works with non-standard extensions', function(done){ | ||
// setup | ||
b._extensions = b._extensions.concat('.coffee') | ||
|
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.
hmm… is this because of minimist? Is there an issue number we can reference?