Files: 89810d797532892ef70d5ee23f3b82c5466e7858 / test / run.js
831 bytesRaw
1 | var spawn = require('child_process').spawn |
2 | var tape = require('tape') |
3 | var path = require('path') |
4 | var mktemp = require('mktemp') |
5 | var rimraf = require('rimraf') |
6 | |
7 | var env = Object.create(process.env) |
8 | env.PATH = __dirname + ':' + env.PATH |
9 | var remote = 'test.js://foo' |
10 | |
11 | var tmpDir = mktemp.createDirSync(path.join(require('os').tmpdir(), 'XXXXXXX')) |
12 | |
13 | function git(args, cb) { |
14 | spawn('git', args, { |
15 | env: env, |
16 | cwd: tmpDir, |
17 | stdio: ['ignore', process.stderr, process.stderr] |
18 | }).on('close', cb) |
19 | } |
20 | |
21 | tape('init repo', function (t) { |
22 | git(['init'], function (code) { |
23 | t.equals(code, 0, 'inited') |
24 | t.end() |
25 | }) |
26 | }) |
27 | |
28 | tape('push with empty repo', function (t) { |
29 | git(['push', remote], function (code) { |
30 | t.equals(code, 0, 'pushed') |
31 | t.end() |
32 | }) |
33 | }) |
34 | |
35 | tape.onFinish(function () { |
36 | if (tmpDir) |
37 | rimraf.sync(tmpDir) |
38 | }) |
39 |
Built with git-ssb-web