mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-16 23:33:38 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
119
node_modules/npm-which/test/1.0.0-interface.js
generated
vendored
Normal file
119
node_modules/npm-which/test/1.0.0-interface.js
generated
vendored
Normal file
@@ -0,0 +1,119 @@
|
||||
"use strict"
|
||||
|
||||
var test = require('tape')
|
||||
|
||||
var path = require('path')
|
||||
|
||||
var npmWhich = require('../')
|
||||
|
||||
var level0 = path.join(__dirname, 'fixtures', 'level0')
|
||||
var level1 = path.join(level0, 'node_modules', 'level1')
|
||||
var level2 = path.join(level1, 'node_modules', 'level2')
|
||||
|
||||
var level = [level0, level1, level2]
|
||||
var binPath = level.map(function(levelPath) {
|
||||
return path.join(levelPath, "node_modules", ".bin")
|
||||
})
|
||||
|
||||
test('includes all .bin dirs in all parent node_modules folders', function(t) {
|
||||
t.test('no nesting', function(t) {
|
||||
var level1Bin = npmWhich.sync('level1', {cwd: level[0]})
|
||||
t.equal(level1Bin, path.join(binPath[0], 'level1'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('nesting', function(t) {
|
||||
var level1Bin = npmWhich.sync('level1', {cwd: level[1]})
|
||||
t.equal(level1Bin, path.join(binPath[0], 'level1'))
|
||||
var level2Bin = npmWhich.sync('level2', {cwd: level[1]})
|
||||
t.equal(level2Bin, path.join(binPath[1], 'level2'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('more nesting', function(t) {
|
||||
var level1Bin = npmWhich.sync('level1', {cwd: level[2]})
|
||||
t.equal(level1Bin, path.join(binPath[0], 'level1'))
|
||||
var level2Bin = npmWhich.sync('level2', {cwd: level[2]})
|
||||
t.equal(level2Bin, path.join(binPath[1], 'level2'))
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which.sync does not mutate PATH', function(t) {
|
||||
var before = process.env.PATH
|
||||
var level1Bin = npmWhich.sync('level1', {cwd: __dirname, env: {PATH: binPath[0]}})
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which.sync does not mutate PATH after failed find', function(t) {
|
||||
var before = process.env.PATH
|
||||
t.throws(function() {
|
||||
var level1Bin = npmWhich.sync('asdasd', {cwd: __dirname, env: {PATH: binPath[0]}})
|
||||
})
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which does not mutate PATH', function(t) {
|
||||
var before = process.env.PATH
|
||||
npmWhich('level1', {cwd: __dirname, env: {PATH: binPath[0]}}, function(err) {
|
||||
t.ifError(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which does not mutate PATH after failed find', function(t) {
|
||||
var before = process.env.PATH
|
||||
npmWhich('asdasd', {cwd: 'asdasdb/jhbhj'}, function(err) {
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('can find path with bad cwd', function(t) {
|
||||
var before = process.env.PATH
|
||||
npmWhich('node', {cwd: '/asdasdb/jhbhj'}, function(err, path) {
|
||||
t.ifError(err)
|
||||
t.ok(path)
|
||||
t.equal(path.split('/').pop(), 'node')
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which does not mutate PATH with bad cmd & cwd', function(t) {
|
||||
var before = process.env.PATH
|
||||
npmWhich('asdasd', {cwd: 'asdasdb/jhbhj'}, function(err) {
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
if (process.version.indexOf('v0.10') !== -1) {
|
||||
// can't test this on 0.11 as process.platform is (rightfully) read-only
|
||||
test('which does not mutate PATH with bad cwd/cmd on "windows"', function(t) {
|
||||
var actualPlatform = process.platform
|
||||
process.platform = "win32"
|
||||
var before = process.env.PATH
|
||||
npmWhich('asdasd', {cwd: 'asdasdb/jhbhj'}, function(err) {
|
||||
process.platform = actualPlatform
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(before, after)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
197
node_modules/npm-which/test/index.js
generated
vendored
Normal file
197
node_modules/npm-which/test/index.js
generated
vendored
Normal file
@@ -0,0 +1,197 @@
|
||||
"use strict"
|
||||
|
||||
var test = require('tape')
|
||||
|
||||
var path = require('path')
|
||||
var join = path.join
|
||||
|
||||
var npmWhich = require('../')
|
||||
|
||||
var level0 = join(__dirname, 'fixtures', 'level0')
|
||||
var level1 = join(level0, 'node_modules', 'level1')
|
||||
var level2 = join(level1, 'node_modules', 'level2')
|
||||
|
||||
var LEVEL = [level0, level1, level2]
|
||||
|
||||
var BINPATH_FOR_LEVEL = LEVEL.map(function(levelPath) {
|
||||
return join(levelPath, "node_modules", ".bin")
|
||||
})
|
||||
|
||||
var before = process.env.PATH
|
||||
|
||||
test('includes all .bin dirs in all parent node_modules folders', function(t) {
|
||||
t.test('no nesting', function(t) {
|
||||
var level1Bin = npmWhich(LEVEL[0]).sync('level1')
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('nesting', function(t) {
|
||||
var which = npmWhich(LEVEL[1])
|
||||
var level1Bin = which.sync('level1')
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
var level2Bin = which.sync('level2')
|
||||
t.equal(level2Bin, join(BINPATH_FOR_LEVEL[1], 'level2'), 'got level2 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('more nesting', function(t) {
|
||||
var which = npmWhich(LEVEL[1])
|
||||
var level1Bin = which.sync('level1')
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
var level2Bin = which.sync('level2')
|
||||
t.equal(level2Bin, join(BINPATH_FOR_LEVEL[1], 'level2'), 'got level2 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which.sync requires a cwd', function(t) {
|
||||
t.throws(function() {
|
||||
npmWhich().sync('level1')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which.sync requires a cwd, can be supplied in options', function(t) {
|
||||
var level1Bin = npmWhich().sync('level1', {cwd: LEVEL[0]})
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which requires a cwd', function(t) {
|
||||
npmWhich()('level1', function(err) {
|
||||
t.ok(err)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which can be curried', function(t) {
|
||||
var which = npmWhich(LEVEL[0])('level1')
|
||||
which(function(err, level1Bin) {
|
||||
t.ifError(err)
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which can be curried, options overridden', function(t) {
|
||||
var which = npmWhich(LEVEL[1])('level1')
|
||||
which({cwd: LEVEL[0]}, function(err, level1Bin) {
|
||||
t.ifError(err)
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which can be curried with sync', function(t) {
|
||||
var which = npmWhich(LEVEL[0])('level1')
|
||||
var level1Bin = which.sync()
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which can be curried with sync, options overridden', function(t) {
|
||||
var which = npmWhich(LEVEL[1])('level1')
|
||||
var level1Bin = which.sync({cwd: LEVEL[0]})
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which requires a cwd, can be supplied in options', function(t) {
|
||||
npmWhich()('level1', {cwd: LEVEL[0]}, function(err, level1Bin) {
|
||||
t.ifError(err)
|
||||
t.equal(level1Bin, join(BINPATH_FOR_LEVEL[0], 'level1'), 'got level1 path')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('cwd can be overridden in options', function(t) {
|
||||
npmWhich(LEVEL[0])('level2', {cwd: LEVEL[1]}, function(err, level2Bin) {
|
||||
t.ifError(err)
|
||||
t.equal(level2Bin, join(BINPATH_FOR_LEVEL[1], 'level2'), 'got level2 path')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which.sync does not mutate PATH', function(t) {
|
||||
npmWhich(__dirname).sync('level1', {env: {PATH: BINPATH_FOR_LEVEL[0]}})
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which.sync does not mutate PATH after failed find', function(t) {
|
||||
t.throws(function() {
|
||||
npmWhich(__dirname).sync('asdasd', {env: {PATH: BINPATH_FOR_LEVEL[0]}})
|
||||
})
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
|
||||
test('which does not mutate PATH', function(t) {
|
||||
var level1Bin = npmWhich(__dirname)('level1', {env: {PATH: BINPATH_FOR_LEVEL[0]}}, function(err) {
|
||||
t.ifError(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which does not mutate PATH after failed find', function(t) {
|
||||
npmWhich('asdasdb/jhbhj')('asdasd', function(err) {
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('can find path with bad cwd', function(t) {
|
||||
npmWhich('/asdasdb/jhbhj')('node', function(err, path) {
|
||||
t.ifError(err)
|
||||
t.ok(path)
|
||||
t.equal(path.split('/').pop(), 'node')
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which does not mutate PATH with bad cmd & cwd', function(t) {
|
||||
npmWhich('asdasdb/jhbhj')('asdasd', function(err) {
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
test('which.sync on default export will error without cwd', function(t) {
|
||||
t.throws(function() {
|
||||
npmWhich.sync('level1')
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
if (process.version.indexOf('v0.10') !== -1) {
|
||||
// can't test this on 0.11 as process.platform is (rightfully) read-only
|
||||
test('which does not mutate PATH with bad cwd/cmd on "windows"', function(t) {
|
||||
var actualPlatform = process.platform
|
||||
process.platform = "win32"
|
||||
npmWhich('asdasdb/jhbhj')('asdasd', function(err) {
|
||||
process.platform = actualPlatform
|
||||
t.ok(err)
|
||||
var after = process.env.PATH
|
||||
t.deepEqual(after, before, 'PATH unmodified')
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Ensure old 1.0.0 tests function, except for the breakages.
|
||||
require('./1.0.0-interface')
|
||||
Reference in New Issue
Block a user