Skip to content

Commit

Permalink
feat(warning): warn if the hook returns undefined, close #10
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed May 4, 2017
1 parent 7ca6029 commit dccdd7e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ function hook (extension, transform, options) {
nestedTransforms[extension].every(function (nested) {
// nesting order performs earlier first, later last
ret = nested(source, filename)
if (ret === undefined) {
console.error('🔥 source transform returned undefined for file',
filename)
}
source = ret + '' // convert to string and keep going
return true // continue
})
Expand Down
2 changes: 1 addition & 1 deletion test/jsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ gt.test('basics', function () {
});
require('./dummy');
gt.ok(transformCalled, 'transform function was called');
});
});

0 comments on commit dccdd7e

Please sign in to comment.