broccoli-funnel
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -136,5 +136,3 @@ 'use strict'; | ||
Funnel.prototype.cleanup = function() { | ||
if (fs.existsSync(this._tmpDir)) { | ||
return rimraf(this._tmpDir); | ||
} | ||
return rimraf(this._tmpDir); | ||
}; | ||
@@ -141,0 +139,0 @@ |
{ | ||
"name": "broccoli-funnel", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Broccoli plugin that allows you to filter files selected from an input tree down based on regular expressions.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
'use strict'; | ||
var fs = require('fs'); | ||
var path = require('path'); | ||
var RSVP = require('rsvp'); | ||
var expect = require('expect.js'); | ||
var walkSync = require('walk-sync'); | ||
var broccoli = require('broccoli'); | ||
var rimraf = RSVP.denodeify(require('rimraf')); | ||
@@ -93,2 +96,22 @@ require('mocha-jshint')(); | ||
describe('without filtering options', function() { | ||
it('linking roots without srcDir/destDir, can rebuild without error', function() { | ||
var inputPath = path.join(fixturePath, 'dir1'); | ||
var tree = new Funnel(inputPath); | ||
builder = new broccoli.Builder(tree); | ||
return builder.build() | ||
.then(function(results) { | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(walkSync(inputPath)); | ||
return builder.build(); | ||
}) | ||
.then(function(results) { | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(walkSync(inputPath)); | ||
}); | ||
}); | ||
it('simply returns a copy of the input tree', function() { | ||
@@ -119,5 +142,38 @@ var inputPath = path.join(fixturePath, 'dir1'); | ||
expect(walkSync(outputPath)).to.eql(walkSync(inputPath)); | ||
}) | ||
.then(function() { | ||
return builder.build(); | ||
}) | ||
.then(function(results) { | ||
var outputPath = path.join(results.directory, 'some-random'); | ||
expect(walkSync(outputPath)).to.eql(walkSync(inputPath)); | ||
}); | ||
}); | ||
it('can properly handle the output path being a broken symlink', function() { | ||
var inputPath = path.join(fixturePath, 'dir1'); | ||
var tree = new Funnel(inputPath, { | ||
srcDir: 'subdir1' | ||
}); | ||
builder = new broccoli.Builder(tree); | ||
return builder.build() | ||
.then(function() { | ||
return rimraf(tree._tmpDir); | ||
}) | ||
.then(function() { | ||
fs.symlinkSync('foo/bar/baz.js', tree._tmpDir); | ||
}) | ||
.then(function() { | ||
return builder.build(); | ||
}) | ||
.then(function(results) { | ||
var restrictedInputPath = path.join(inputPath, 'subdir1'); | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(walkSync(restrictedInputPath)); | ||
}); | ||
}); | ||
it('simply returns a copy of the input tree at a nested source', function() { | ||
@@ -136,2 +192,11 @@ var inputPath = path.join(fixturePath, 'dir1'); | ||
expect(walkSync(outputPath)).to.eql(walkSync(restrictedInputPath)); | ||
}) | ||
.then(function() { | ||
return builder.build(); | ||
}) | ||
.then(function(results) { | ||
var restrictedInputPath = path.join(inputPath, 'subdir1'); | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(walkSync(restrictedInputPath)); | ||
}); | ||
@@ -147,9 +212,18 @@ }); | ||
var expected = []; | ||
builder = new broccoli.Builder(tree); | ||
return builder.build() | ||
.then(function(results) { | ||
var expected = []; | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(expected); | ||
}) | ||
.then(function() { | ||
return builder.build(); | ||
}) | ||
.then(function(results) { | ||
var outputPath = results.directory; | ||
expect(walkSync(outputPath)).to.eql(expected); | ||
}); | ||
@@ -156,0 +230,0 @@ }); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
33132
595
2