describe('paths', () => { it('should return an array of directories', () => { assert(paths().length > 1); }); it('should include node_modules in the cwd', () => { assert(paths().includes(path.join(process.cwd(), 'node_modules'))); }); it('should include /node_modules', () => { assert(paths().includes('/node_modules')); }); it('should include APPDATA path on windows', function() { if (!isWindows) { this.skip(); return; } let dir = path.join(process.env.APPDATA, 'npm', 'node_modules'); assert(paths().includes(dir)); }); it('should include npm global modules', () => { assert(paths().includes(gm)); }); });
describe('resolve', function() { it('should resolve the git config in the cwd by default', function() { assert.equal(parse.resolve(), path.resolve(process.cwd(), '.git/config')); }); it('should allow override path', function() { const fp = path.resolve(os.homedir(), '.gitconfig'); assert.equal(parse.resolve({ path: fp }), fp); }); it('should include other config sources', function() { const fp = path.join(__dirname, 'fixtures/_gitconfig'); const actual = parse.sync({ path: fp, include: true }); assert.deepEqual(actual, require('./expected/_gitconfig.js')); }); it('should resolve relative path to cwd', function() { 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() { if (isTravis && os.platform() === 'darwin') return this.skip(); assert.equal(parse.resolve('global'), path.resolve(os.homedir(), '.gitconfig')); }); it('should allow override of cwd', function() { const actual = parse.resolve({ path: '.config', cwd: '/opt/config' }); assert.equal(actual, path.resolve('/opt/config/.config')); }); });
describe('code style', () => { it('should follow editorconfig conventions', function (done) { this.retries(0); this.slow(2000); exec('npm run lint:editorconfig', { cwd: path.join(__dirname, '..') }, (err, stdout) => { if (err) { // Check failed if (err.code === 1) return done(new Error(stdout)); // Command failed else return this.skip(); } done(); }); }); it('should follow eslint standards', function (done) { this.retries(0); this.slow(2000); exec('npm run lint:eslint', { cwd: path.join(__dirname, '..') }, (err, stdout) => { if (err) { // Check failed if (err.code === 1) return done(new Error(stdout)); // Command failed else return this.skip(); } done(); }); }); });
if (result === null) this.skip(); done(); });
if (result === null) this.skip(); done(); });