Skip to content

Commit

Permalink
Fix: opts.groups.output return undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
zoubin committed Feb 29, 2016
1 parent c30dd73 commit 6c32f75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 12 deletions.
1 change: 1 addition & 0 deletions lib/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ class Groups extends Transform {
if (typeof opts.output === 'function') {
return function (file) {
let ret = opts.output(file)
if (!ret) return
ret = path.resolve(basedir, ret)
// Make sure the returned path is always relative to basedir
return path.relative(basedir, ret)
Expand Down
13 changes: 1 addition & 12 deletions test/groups.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ test('groupFilter.output', function(tt) {
groupFilter: filter,
})
groups.once('groups', function (groupsMap) {
t.same(groupsMap.size, 3)
t.same(groupsMap.size, 2)
t.same(
sort(groupsMap.get('A.js')),
[
Expand All @@ -79,10 +79,6 @@ test('groupFilter.output', function(tt) {
'/path/to/src/page/B/index.js',
]
)
t.same(
sort(groupsMap.get('C.js')),
['/path/to/node_modules/C/index.js']
)
t.end()
})
source().pipe(groups)
Expand All @@ -95,9 +91,6 @@ test('groupFilter.output', function(tt) {
if (/B/.test(file)) {
return 'B.js'
}
if (/C/.test(file)) {
return 'C.js'
}
}))

tt.test('string', run.bind(null, [
Expand All @@ -109,10 +102,6 @@ test('groupFilter.output', function(tt) {
filter: '**/B/index.js',
output: 'B.js',
},
{
filter: '**/C/index.js',
output: 'C.js',
},
]))

tt.end()
Expand Down

0 comments on commit 6c32f75

Please sign in to comment.