-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
6 changed files
with
90 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
var util = require('./util'); | ||
var test = util.test; | ||
var compare = util.compare; | ||
var expect = util.expect; | ||
|
||
describe('issues/12', function() { | ||
|
||
it('should output a reduced path with extensions stripped when resolver: ["path-reduce", "strip-ext"] is used', function(done) { | ||
test( | ||
'./dummies/include/module.js', | ||
'var deps = require("./*", {mode: "hash", resolve: [ "strip-ext", "path-reduce" ]});', | ||
function(data) { | ||
expect(data).to.equal("var deps = {'INCLUDED': require('./INCLUDED.js'),'INCLUDED2': require('./INCLUDED2.js')};"); | ||
}, done); | ||
}); | ||
|
||
it('should output a reduced path with extensions stripped when resolver: ["strip-ext", "path-reduce"] is used', function(done) { | ||
test( | ||
'./dummies/include/module.js', | ||
'var deps = require("./*", {mode: "hash", resolve: [ "path-reduce", "strip-ext" ]});', | ||
function(data) { | ||
expect(data).to.equal("var deps = {'INCLUDED': require('./INCLUDED.js'),'INCLUDED2': require('./INCLUDED2.js')};"); | ||
}, done); | ||
}); | ||
|
||
it('should return the same whether path-reduce or strip-ext comes first', function(done) { | ||
compare('./dummies/module.js', | ||
'require("./include/**/*", {mode: "hash", resolve: [ "strip-ext", "path-reduce" ]});', | ||
'require("./include/**/*", {mode: "hash", resolve: [ "path-reduce", "strip-ext" ]});', | ||
done); | ||
}); | ||
|
||
}); | ||
|
||
describe('issues/13', function() { | ||
// // Input | ||
// var templates = require('./templates/*.hbs', { mode: 'hash' }); | ||
// | ||
// // Output | ||
// var templates = { | ||
// './templates/zoning': require('./templates/zoning.hbs') | ||
// }; | ||
// | ||
// // Output expected | ||
// var templates = { | ||
// 'zoning.hbs': require('./templates/zoning.hbs') | ||
// }; | ||
it('should output a single file with relative directory without extension', function(done) { | ||
test( | ||
'./dummies/include/module.js', | ||
'var deps = require("./nesting/*.js", {mode: "hash"});', //default resolve: ["path-reduce", "strip-ext"] | ||
function(data) { | ||
expect(data).to.equal("var deps = {'NESTED_INCLUDE': require('./nesting/NESTED_INCLUDE.js')};"); | ||
}, done); | ||
}); | ||
|
||
it('should output a single file with relative directory with extension if only path-reduce is specified', function(done) { | ||
test( | ||
'./dummies/include/module.js', | ||
'var deps = require("./nesting/*.js", {mode: "hash", resolve:["path-reduce"]});', //default resolve: ["path-reduce", "strip-ext"] | ||
function(data) { | ||
expect(data).to.equal("var deps = {'NESTED_INCLUDE.js': require('./nesting/NESTED_INCLUDE.js')};"); | ||
}, done); | ||
}); | ||
}); |