mirror of
https://gitlab.silvrtree.co.uk/martind2000/nci.git
synced 2025-01-10 23:55:08 +00:00
move test repository unpacking to npm scripts
This commit is contained in:
parent
73213e3a4e
commit
670e83a843
@ -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"
|
||||
},
|
||||
|
20
test/scm.js
20
test/scm.js
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user