mirror of
https://github.com/bower/bower.git
synced 2026-04-24 03:00:19 -04:00
Fix some bugs when extracting archives, add some tests.
This commit is contained in:
BIN
test/assets/package-zip-folder.zip
Normal file
BIN
test/assets/package-zip-folder.zip
Normal file
Binary file not shown.
BIN
test/assets/package-zip.zip
Normal file
BIN
test/assets/package-zip.zip
Normal file
Binary file not shown.
@@ -130,7 +130,7 @@ describe('FsResolver', function () {
|
||||
.done();
|
||||
});
|
||||
|
||||
it('should not copy ignored paths', function (next) {
|
||||
it('should not copy ignored paths (to speed up copying)', function (next) {
|
||||
var resolver = new FsResolver(testPackage);
|
||||
|
||||
// Override the _applyPkgMeta function to prevent it from deleting ignored files
|
||||
@@ -144,5 +144,29 @@ describe('FsResolver', function () {
|
||||
})
|
||||
.done();
|
||||
});
|
||||
|
||||
it('should extract if source is an archive', function (next) {
|
||||
var resolver = new FsResolver(path.resolve(__dirname, '../../assets/package-zip.zip'));
|
||||
|
||||
resolver.resolve()
|
||||
.then(function (dir) {
|
||||
expect(fs.existsSync(path.join(dir, 'foo.js'))).to.be(true);
|
||||
expect(fs.existsSync(path.join(dir, 'package-zip.zip'))).to.be(false);
|
||||
next();
|
||||
})
|
||||
.done();
|
||||
});
|
||||
|
||||
it('should copy extracted folder contents if it\'s single to the root', function (next) {
|
||||
var resolver = new FsResolver(path.resolve(__dirname, '../../assets/package-zip-folder.zip'));
|
||||
|
||||
resolver.resolve()
|
||||
.then(function (dir) {
|
||||
expect(fs.existsSync(path.join(dir, 'foo.js'))).to.be(true);
|
||||
expect(fs.existsSync(path.join(dir, 'package-zip'))).to.be(false);
|
||||
next();
|
||||
})
|
||||
.done();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,8 @@
|
||||
// Cleanup the uncaughtException added by the tmp module
|
||||
// It messes with the mocha uncaughtException event to caught errors
|
||||
// Please note that is the Resolver that calls tmp.setGracefulCleanup()
|
||||
// so we need to require that before
|
||||
require('../lib/resolve/Resolver');
|
||||
process.removeAllListeners('uncaughtException');
|
||||
|
||||
require('./resolve/resolver');
|
||||
|
||||
Reference in New Issue
Block a user