forked from nodegit/nodegit
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrunner.js
More file actions
60 lines (54 loc) · 1.56 KB
/
runner.js
File metadata and controls
60 lines (54 loc) · 1.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
var promisify = require("promisify-node");
var fse = promisify("fs-extra");
var path = require("path");
var local = path.join.bind(path, __dirname);
// Have to wrap exec, since it has a weird callback signature.
var exec = promisify(function(command, opts, callback) {
return require("child_process").exec(command, opts, callback);
});
var workdirPath = local("repos/workdir");
before(function() {
this.timeout(350000);
var url = "https://github.com/nodegit/test";
return fse.remove(local("repos"))
.then(function() {
fse.mkdir(local("repos"));
})
.then(function() {
return exec("git init " + local("repos", "empty"));
})
.then(function() {
return exec("git clone " + url + " " + workdirPath);
})
.then(function() {
return exec("git checkout rev-walk", {cwd: workdirPath});
})
.then(function() {
return exec("git checkout checkout-test", {cwd: workdirPath});
})
.then(function() {
return exec("git checkout master", {cwd: workdirPath});
})
.then(function() {
return fse.mkdir(local("repos", "nonrepo"));
})
.then(function() {
return fse.writeFile(local("repos", "nonrepo", "file.txt"),
"This is a bogus file");
});
});
beforeEach(function() {
return exec("git clean -xdf", {cwd: workdirPath})
.then(function() {
return exec("git checkout master", {cwd: workdirPath});
})
.then(function() {
return exec("git reset --hard", {cwd: workdirPath});
});
});
afterEach(function(done) {
process.nextTick(function() {
global.gc();
done();
});
});