Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions index.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,11 @@ function Filter(inputTree, options) {
throw new TypeError('Filter is an abstract class and must be sub-classed');
}

// Validate that a single node was passed in
if (Array.isArray(inputTree)) {
throw new Error('inputTree should be a single tree, array was passed');
}

var name = 'broccoli-filter:' + (this.constructor.name);
if (this.description) {
name += ' > [' + this.description + ']';
Expand Down
7 changes: 7 additions & 0 deletions test/test.js
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,13 @@ describe('Filter', function() {
});


it('should throw if constructor is passed array of trees', function() {
expect(function() {
new IncompleteFilter(['.']);
}).to.throw(Error, /array was passed/);
});


it('should throw if `processString` is not implemented', function() {
expect(function() {
new IncompleteFilter('.').processString('foo', 'fake_path');
Expand Down