mirror of
https://github.com/morhetz/gruvbox.git
synced 2025-11-17 07:43:38 -05:00
chore(package): re-init package with commitizen and standard-release
This commit is contained in:
1
node_modules/npm-which/.npmignore
generated
vendored
Normal file
1
node_modules/npm-which/.npmignore
generated
vendored
Normal file
@@ -0,0 +1 @@
|
||||
node_modules
|
||||
6
node_modules/npm-which/.travis.yml
generated
vendored
Normal file
6
node_modules/npm-which/.travis.yml
generated
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
language: node_js
|
||||
before_install: npm install npm -g
|
||||
node_js:
|
||||
- 4.0
|
||||
- 4
|
||||
- 6
|
||||
21
node_modules/npm-which/LICENSE
generated
vendored
Normal file
21
node_modules/npm-which/LICENSE
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2014 Tim Oxley
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
109
node_modules/npm-which/Readme.md
generated
vendored
Normal file
109
node_modules/npm-which/Readme.md
generated
vendored
Normal file
@@ -0,0 +1,109 @@
|
||||
# npm-which
|
||||
|
||||
### Locate a program or locally installed node module executable
|
||||
|
||||
[](https://travis-ci.org/timoxley/npm-which)
|
||||
|
||||
Use `npm-which` to locate executables which may be installed in the
|
||||
local 'node_modules/.bin', or in a parent 'node_modules/.bin' directory.
|
||||
|
||||
`npm-which` runs in the context of an npm lifecycle script with its npm-modified PATH.
|
||||
|
||||
i.e. if you install a module that has an executable script using npm install, that module's executable will be picked up by `npm-which` from anywhere in the ./node_modules tree.
|
||||
|
||||
## Installation
|
||||
|
||||
```bash
|
||||
> npm install -g npm-which
|
||||
```
|
||||
|
||||
## Usage
|
||||
|
||||
### Programmatic
|
||||
|
||||
`npm-which` will find executables relative to the cwd you supply.
|
||||
The cwd is required in order to be explicit and reduce confusion when
|
||||
things that should be found are not.
|
||||
|
||||
#### Asynchronous
|
||||
|
||||
```js
|
||||
var which = require('npm-which')(process.cwd()) // remember to supply cwd
|
||||
which('tape', function(err, pathToTape) {
|
||||
if (err) return console.error(err.message)
|
||||
console.log(pathToTape) // /Users/.../node_modules/.bin/tape
|
||||
})
|
||||
```
|
||||
|
||||
#### Synchronous
|
||||
|
||||
```js
|
||||
var which = require('npm-which')(__dirname) // __dirname often good enough
|
||||
var pathToTape = which.sync('tape')
|
||||
console.log(pathToTape) // /Users/.../node_modules/.bin/tape
|
||||
```
|
||||
|
||||
#### Options
|
||||
|
||||
Both async and sync versions take an optional options object:
|
||||
|
||||
* Set `options.env` if you wish to use something other than `process.env` (the default)
|
||||
* Set `options.cwd` to supply the cwd as a named argument. Mainly for semi-backwards compatibility with npm-which 1.0.0.
|
||||
|
||||
```js
|
||||
which('tape', {cwd: '/some/other/path'}, function() {
|
||||
// ...
|
||||
})
|
||||
```
|
||||
|
||||
### Command Line
|
||||
|
||||
```bash
|
||||
> npm-which tape
|
||||
/Users/timoxley/Projects/npm-which/node_modules/.bin/tape
|
||||
```
|
||||
|
||||
This is the equivalent of running an npm script with the body: `which tape`.
|
||||
|
||||
### Example
|
||||
|
||||
```bash
|
||||
# unless something is installed in a node_modules
|
||||
# npm-which and which(1) will have the same output:
|
||||
|
||||
> which tape
|
||||
/usr/local/bin/tape
|
||||
|
||||
> npm-which tape
|
||||
/usr/local/bin/tape
|
||||
|
||||
# install tape local to current dir
|
||||
# tape includes an executable 'tape'
|
||||
> npm install tape
|
||||
> ./node_modules/.bin/tape && echo 'found'
|
||||
found
|
||||
|
||||
# vanilla which(1) still finds global tape
|
||||
> which tape
|
||||
/usr/local/bin/tape
|
||||
|
||||
# npm-which finds locally installed tape :)
|
||||
> npm-which tape
|
||||
/Users/timoxley/Projects/npm-which/node_modules/.bin/tape
|
||||
```
|
||||
|
||||
## Why
|
||||
|
||||
#### npm is slow to boot
|
||||
|
||||
* Shelling out to `npm bin` is very slow; it has to wait for all of npm to boot up – this often takes longer than the actual script you want to execute!
|
||||
|
||||
#### Hard-coding paths to modules is very fragile
|
||||
|
||||
* You can't rely on './node_modules' actually containing your module! The module may exist much higher in the directory hierarchy.
|
||||
* `npm bin` returns the location of the `./node_modules/.bin` directory, but it does not take into account being called within the context of another module, also, npm slow.
|
||||
* If the module does exist in a parent directory, then './node_modules/.bin' will be missing your module's executable.
|
||||
|
||||
## License
|
||||
|
||||
MIT
|
||||
35
node_modules/npm-which/bin/npm-which.js
generated
vendored
Executable file
35
node_modules/npm-which/bin/npm-which.js
generated
vendored
Executable file
@@ -0,0 +1,35 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
"use strict"
|
||||
|
||||
var program = require('commander');
|
||||
var pkg = require('../package.json')
|
||||
|
||||
var npmWhich = require('../')
|
||||
|
||||
program
|
||||
.version(pkg.version)
|
||||
.option('-c, --silent', 'No output, just return 0 if any of the executables are found, or 1 if none are found.')
|
||||
.usage('<command>')
|
||||
.parse(process.argv)
|
||||
|
||||
if (!program.args.length) return program.help()
|
||||
|
||||
var cmd = program.args[0]
|
||||
|
||||
if (program.silent) {
|
||||
try {
|
||||
npmWhich(process.cwd()).sync(cmd)
|
||||
process.exit(0)
|
||||
} catch (e) {
|
||||
if (!e.message.match('not found:')) throw e
|
||||
process.exit(1)
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
console.log(npmWhich(process.cwd()).sync(cmd))
|
||||
} catch (e) {
|
||||
if (!e.message.match('not found:')) throw e
|
||||
console.error('%s not found', cmd)
|
||||
}
|
||||
77
node_modules/npm-which/index.js
generated
vendored
Normal file
77
node_modules/npm-which/index.js
generated
vendored
Normal file
@@ -0,0 +1,77 @@
|
||||
"use strict"
|
||||
|
||||
var which = require('which')
|
||||
var npmPath = require('npm-path')
|
||||
|
||||
module.exports = function(cwd) {
|
||||
function npmWhich(cmd, options, fn) {
|
||||
// options is optional
|
||||
if (options instanceof Function) fn = options, options = null
|
||||
options = options || {}
|
||||
options.cwd = options.cwd || cwd
|
||||
options.env = options.env || process.env
|
||||
|
||||
function curryWhich(opts, fn) {
|
||||
if (opts instanceof Function) fn = opts, opts = null
|
||||
opts = opts || {}
|
||||
return npmWhich(cmd, mixin(opts, options), fn)
|
||||
}
|
||||
|
||||
curryWhich.sync = function(opts) {
|
||||
opts = opts || {}
|
||||
return npmWhich.sync(cmd, mixin(opts, options))
|
||||
}
|
||||
|
||||
if (!(typeof fn === 'function')) return curryWhich
|
||||
|
||||
if (!options.cwd) return fn(new Error('You must specify a cwd.'))
|
||||
|
||||
npmPath.get(options, function(err, newPath) {
|
||||
if (err) return fn(err)
|
||||
var oldPath = process.env[npmPath.PATH]
|
||||
process.env[npmPath.PATH] = newPath
|
||||
which(cmd, function(err, result) {
|
||||
process.env[npmPath.PATH] = oldPath
|
||||
fn(err, result)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
npmWhich.sync = function(cmd, options) {
|
||||
|
||||
options = options || {}
|
||||
options.cwd = options.cwd || cwd
|
||||
options.env = options.env || process.env
|
||||
|
||||
if (!options.cwd) throw new Error('You must specify a cwd.')
|
||||
var err = null
|
||||
try {
|
||||
var oldPath = process.env[npmPath.PATH]
|
||||
var newPath = npmPath.getSync(options)
|
||||
process.env[npmPath.PATH] = newPath
|
||||
var result = which.sync(cmd)
|
||||
return result
|
||||
} catch(e) {
|
||||
err = e
|
||||
} finally {
|
||||
process.env[npmPath.PATH] = oldPath
|
||||
if (err) throw err
|
||||
}
|
||||
return result
|
||||
}
|
||||
|
||||
if (arguments.length <= 1) return npmWhich
|
||||
return module.exports().apply(this, arguments)
|
||||
}
|
||||
|
||||
module.exports.sync = function(cmd, options) {
|
||||
options = options || {}
|
||||
return module.exports(options.cwd).sync(cmd, options)
|
||||
}
|
||||
|
||||
function mixin(a, b) {
|
||||
for (var key in b) {
|
||||
a[key] = b[key]
|
||||
}
|
||||
return a
|
||||
}
|
||||
1
node_modules/npm-which/node_modules/.bin/npm-path
generated
vendored
Symbolic link
1
node_modules/npm-which/node_modules/.bin/npm-path
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../npm-path/bin/npm-path
|
||||
1
node_modules/npm-which/node_modules/.bin/which
generated
vendored
Symbolic link
1
node_modules/npm-which/node_modules/.bin/which
generated
vendored
Symbolic link
@@ -0,0 +1 @@
|
||||
../../../which/bin/which
|
||||
43
node_modules/npm-which/package.json
generated
vendored
Normal file
43
node_modules/npm-which/package.json
generated
vendored
Normal file
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"name": "npm-which",
|
||||
"version": "3.0.1",
|
||||
"description": "Locate a program or locally installed node module's executable",
|
||||
"main": "index.js",
|
||||
"bin": {
|
||||
"npm-which": "bin/npm-which.js"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "node test/index.js | tap-spec"
|
||||
},
|
||||
"author": "Tim Oxley",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=4.2.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"commander": "^2.9.0",
|
||||
"npm-path": "^2.0.2",
|
||||
"which": "^1.2.10"
|
||||
},
|
||||
"devDependencies": {
|
||||
"tap-spec": "^4.1.1",
|
||||
"tape": "^4.6.0"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/timoxley/npm-which.git"
|
||||
},
|
||||
"keywords": [
|
||||
"npm",
|
||||
"path",
|
||||
"executable",
|
||||
"run"
|
||||
],
|
||||
"bugs": {
|
||||
"url": "https://github.com/timoxley/npm-which/issues"
|
||||
},
|
||||
"homepage": "https://github.com/timoxley/npm-which"
|
||||
}
|
||||
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