Skip to content

Commit

Permalink
Fixed #14
Browse files Browse the repository at this point in the history
  • Loading branch information
call-a3 committed May 20, 2015
1 parent 315899f commit f3bb41a
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,9 @@ module.exports = require('browserify-transform-tools').makeRequireTransform(
}

// find mode
if (modes.hasOwnProperty(config.mode)) {
if (typeof config.mode === 'function') {
mode = config.mode;
} else if (modes.hasOwnProperty(config.mode)) {
mode = modes[config.mode];
} else {
console.warn("Unknown mode: " + config.mode);
Expand Down
11 changes: 11 additions & 0 deletions spec/issues-1.2.1.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,3 +63,14 @@ describe('issues/13', function() {
}, done);
});
});

describe('issues/14', function() {
it('should allow the use of a custom mode', function(done) {
test(
'./dummies/include/module.js',
'var deps = require("./nesting/*.js", {mode: function(base, files, config) {return "require(\'nothing\')"}});', //default resolve: ["path-reduce", "strip-ext"]
function(data) {
expect(data).to.equal("var deps = require(\'nothing\');");
}, done);
});
});

0 comments on commit f3bb41a

Please sign in to comment.