-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: test interop with original git-evtag
- Loading branch information
Showing
3 changed files
with
82 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
'use strict'; | ||
|
||
const tape = require('tape'); | ||
|
||
const fixtures = require('./fixtures'); | ||
|
||
const cli = fixtures.cli; | ||
const cmd = fixtures.cmd; | ||
|
||
tape('evtag interop', (t) => { | ||
fixtures.clone('git://github.com/cgwalters/git-evtag.git'); | ||
|
||
// Verify tags | ||
const node = process.execPath; | ||
t.doesNotThrow(() => cmd(node, [ cli, '--insecure', '-v', 'v2016.1' ]), | ||
'valid evtag #1'); | ||
t.doesNotThrow(() => cmd(node, [ cli, '--insecure', '-v', 'v2015.2' ]), | ||
'valid evtag #2'); | ||
|
||
fixtures.destroy(); | ||
t.end(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
const path = require('path'); | ||
const spawnSync = require('child_process').spawnSync; | ||
|
||
const rimraf = require('rimraf'); | ||
|
||
const gst = require('../../'); | ||
const GIT = gst.GIT; | ||
|
||
const cli = path.join(__dirname, '..', '..', 'bin', 'git-secure-tag'); | ||
exports.cli = cli; | ||
|
||
const repo = path.join(__dirname, 'repo'); | ||
exports.repo = repo; | ||
|
||
function cmd(name, args, noCwd) { | ||
const p = spawnSync(name, args, { | ||
stdio: [ null, 'pipe', 'pipe' ], | ||
cwd: noCwd ? undefined : repo | ||
}); | ||
if (p.status !== 0) { | ||
const msg = `${name} ${args.join(' ')} failed`; | ||
throw new Error(msg + '\n' + p.stdout + '\n' + p.stderr); | ||
} | ||
} | ||
exports.cmd = cmd; | ||
|
||
function write(file, content) { | ||
fs.writeFileSync(path.join(repo, file), content); | ||
} | ||
exports.write = write; | ||
|
||
// Initialize repo | ||
exports.init = function init() { | ||
rimraf.sync(repo); | ||
fs.mkdirSync(repo); | ||
|
||
cmd(GIT, [ 'init' ]); | ||
cmd(GIT, [ 'config', 'user.email', 'john@doe.org' ]); | ||
cmd(GIT, [ 'config', 'user.name', 'John Doe' ]); | ||
}; | ||
|
||
// Clone repo | ||
exports.clone = function clone(url) { | ||
rimraf.sync(repo); | ||
cmd(GIT, [ 'clone', url, repo ], true); | ||
}; | ||
|
||
exports.destroy = function destroy() { | ||
rimraf.sync(repo); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters