Skip to content

Commit

Permalink
switch entirely to chai, no longer use expect.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanpenner committed Sep 20, 2016
1 parent 0a61213 commit 0fffb9d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"devDependencies": {
"broccoli-builder": "^0.18.0",
"chai": "^3.2.0",
"expect.js": "^0.3.1",
"mocha": "~3.0.2",
"mocha-jshint": "2.3.1",
"rimraf": "^2.3.2",
Expand Down
24 changes: 12 additions & 12 deletions tests/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
var fs = require('fs');
var path = require('path');
var RSVP = require('rsvp');
var expect = require('expect.js');
var expect = require('chai').expect;
var walkSync = require('walk-sync');
var broccoli = require('broccoli-builder');
var rimraf = RSVP.denodeify(require('rimraf'));
Expand Down Expand Up @@ -421,7 +421,7 @@ describe('broccoli-funnel', function(){
files: ['anything'],
include: ['*.txt']
});
}).to.throwException('Cannot pass files option (array or function) and a include/exlude filter. You can only have one or the other');
}).to.throw('Cannot pass files option (array or function) and a include/exlude filter. You can only have one or the other');
});

it('so error if `files` and `exclude` are set', function() {
Expand All @@ -432,7 +432,7 @@ describe('broccoli-funnel', function(){
files: function() { return ['anything']; },
exclude: ['*.md']
});
}).to.throwException('Cannot pass files option (array or function) and a include/exlude filter. You can only have one or the other');
}).to.throw('Cannot pass files option (array or function) and a include/exlude filter. You can only have one or the other');
});
});

Expand Down Expand Up @@ -760,36 +760,36 @@ describe('broccoli-funnel', function(){
it('returns false if the path is included in an exclude filter', function() {
node.exclude = [ /.foo$/, /.bar$/ ];

expect(node.includeFile('blah/blah/blah.foo')).to.not.be.ok();
expect(node.includeFile('blah/blah/blah.bar')).to.not.be.ok();
expect(node.includeFile('blah/blah/blah.baz')).to.be.ok();
expect(node.includeFile('blah/blah/blah.foo')).to.eql(false);
expect(node.includeFile('blah/blah/blah.bar')).to.eql(false);
expect(node.includeFile('blah/blah/blah.baz')).to.eql(true);
});

it('returns true if the path is included in an include filter', function() {
node.include = [ /.foo$/, /.bar$/ ];

expect(node.includeFile('blah/blah/blah.foo')).to.be.ok();
expect(node.includeFile('blah/blah/blah.bar')).to.be.ok();
expect(node.includeFile('blah/blah/blah.foo')).to.eql(true);
expect(node.includeFile('blah/blah/blah.bar')).to.eql(true);
});

it('returns false if the path is not included in an include filter', function() {
node.include = [ /.foo$/, /.bar$/ ];

expect(node.includeFile('blah/blah/blah.baz')).to.not.be.ok();
expect(node.includeFile('blah/blah/blah.baz')).to.not.eql(true);
});

it('returns true if no patterns were used', function() {
expect(node.includeFile('blah/blah/blah.baz')).to.be.ok();
expect(node.includeFile('blah/blah/blah.baz')).to.eql(true);
});

it('uses a cache to ensure we do not recalculate the filtering on subsequent attempts', function() {
expect(node.includeFile('blah/blah/blah.baz')).to.be.ok();
expect(node.includeFile('blah/blah/blah.baz')).to.eql(true);

// changing the filter mid-run should have no result on
// previously calculated paths
node.include = [ /.foo$/, /.bar$/ ];

expect(node.includeFile('blah/blah/blah.baz')).to.be.ok();
expect(node.includeFile('blah/blah/blah.baz')).to.eql(true);
});
});

Expand Down

0 comments on commit 0fffb9d

Please sign in to comment.