move test repository unpacking to npm scripts

This commit is contained in:
oleg 2015-07-15 07:29:43 +03:00
parent 73213e3a4e
commit 670e83a843
2 changed files with 4 additions and 19 deletions

View File

@ -6,7 +6,8 @@
"nci": "bin/nci"
},
"scripts": {
"test": "mocha --bail --reporter=spec test/index --timeout 4000",
"makeTestRepos": "rm -rf test/repos/{mercurial,git}; cd test/repos/ && tar -xf mercurial.tar.gz && tar -xf git.tar.gz",
"test": "npm run makeTestRepos && mocha --bail --reporter=spec test/index --timeout 4000",
"dev": "gulp",
"sync": "npm install && npm prune && bower install && bower prune"
},

View File

@ -18,32 +18,16 @@ var getTestData = function(type) {
['mercurial', 'git'].forEach(function(type) {
describe(type, function() {
var data = getTestData(type),
originalRepositoryPath = path.join(__dirname, 'repos', type),
repositoryName = 'test-repository',
repositoryPath = path.join(
path.join(__dirname, 'repos'), repositoryName
),
originalRepositoryPath = path.join(__dirname, 'repos', type);
);
function rmdir(dir, callback) {
new SpawnCommand().run({cmd: 'rm', args: ['-R', dir]}, callback);
}
it('remove original repository dir if it exists', function(done) {
if (fs.exists(originalRepositoryPath, function(isExists) {
if (isExists) {
rmdir(originalRepositoryPath, done);
} else {
done();
}
}));
});
it('unpack original repository', function(done) {
new SpawnCommand().run({cmd: 'tar', args: [
'-xvf', type + '.tar.gz'
], options: {cwd: path.join(__dirname, 'repos')}}, done);
});
it('remove test repository dir if it exists', function(done) {
if (fs.exists(repositoryPath, function(isExists) {
if (isExists) {