|
|
@ -10,6 +10,7 @@
|
|
|
|
require('mocha');
|
|
|
|
require('mocha');
|
|
|
|
var assert = require('assert');
|
|
|
|
var assert = require('assert');
|
|
|
|
var path = require('path');
|
|
|
|
var path = require('path');
|
|
|
|
|
|
|
|
var home = require('os-homedir');
|
|
|
|
var parse = require('./');
|
|
|
|
var parse = require('./');
|
|
|
|
|
|
|
|
|
|
|
|
describe('sync:', function() {
|
|
|
|
describe('sync:', function() {
|
|
|
@ -52,7 +53,7 @@ describe('resolve:', function() {
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should allow override path', function() {
|
|
|
|
it('should allow override path', function() {
|
|
|
|
var fp = path.resolve(process.env.HOME, '.gitconfig');
|
|
|
|
var fp = path.resolve(home(), '.gitconfig');
|
|
|
|
assert.equal(parse.resolve({path: fp}), fp);
|
|
|
|
assert.equal(parse.resolve({path: fp}), fp);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -60,6 +61,10 @@ describe('resolve:', function() {
|
|
|
|
assert.equal(parse.resolve({path: '.config'}), path.resolve(process.cwd(), '.config'));
|
|
|
|
assert.equal(parse.resolve({path: '.config'}), path.resolve(process.cwd(), '.config'));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
it('should resolve relative path to the global git config when `global` is passed', function() {
|
|
|
|
|
|
|
|
assert.equal(parse.resolve('global'), path.resolve(home(), '.gitconfig'));
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
it('should allow override of cwd', function() {
|
|
|
|
it('should allow override of cwd', function() {
|
|
|
|
var actual = parse.resolve({path: '.config', cwd: '/opt/config'});
|
|
|
|
var actual = parse.resolve({path: '.config', cwd: '/opt/config'});
|
|
|
|
assert.equal(actual, path.resolve('/opt/config/.config'));
|
|
|
|
assert.equal(actual, path.resolve('/opt/config/.config'));
|
|
|
|