add tests for 'vscode:packagedDependencies'
This commit is contained in:
parent
818c42695a
commit
c2f00bc49e
26 changed files with 1297 additions and 1 deletions
21
src/test/fixtures/packagedDependencies/node_modules/.yarn-integrity
generated
vendored
Normal file
21
src/test/fixtures/packagedDependencies/node_modules/.yarn-integrity
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
{
|
||||
"systemParams": "darwin-x64-57",
|
||||
"modulesFolders": [
|
||||
"node_modules"
|
||||
],
|
||||
"flags": [],
|
||||
"linkedModules": [
|
||||
"vscode-nls-dev"
|
||||
],
|
||||
"topLevelPatterns": [
|
||||
"isexe@1.0.0",
|
||||
"which@1.3.1"
|
||||
],
|
||||
"lockfileEntries": {
|
||||
"isexe@1.0.0": "https://registry.yarnpkg.com/isexe/-/isexe-1.0.0.tgz#9aa37a1d11d27b523bec4f8791b72af1ead44ee3",
|
||||
"isexe@^2.0.0": "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
|
||||
"which@1.3.1": "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
},
|
||||
"files": [],
|
||||
"artifacts": {}
|
||||
}
|
2
src/test/fixtures/packagedDependencies/node_modules/isexe/.npmignore
generated
vendored
Normal file
2
src/test/fixtures/packagedDependencies/node_modules/isexe/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.nyc_output/
|
||||
coverage/
|
42
src/test/fixtures/packagedDependencies/node_modules/isexe/README.md
generated
vendored
Normal file
42
src/test/fixtures/packagedDependencies/node_modules/isexe/README.md
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
# isexe
|
||||
|
||||
Minimal module to check if a file is executable.
|
||||
|
||||
Uses `fs.access` if available, and tests against the `PATHEXT`
|
||||
environment variable on Windows.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var isexe = require('isexe')
|
||||
isexe('some-file-name', function (err, isExe) {
|
||||
if (err) {
|
||||
console.error('probably file does not exist or something', err)
|
||||
} else if (isExe) {
|
||||
console.error('this thing can be run')
|
||||
} else {
|
||||
console.error('cannot be run')
|
||||
}
|
||||
})
|
||||
|
||||
// same thing but synchronous, throws errors
|
||||
var isExe = isexe.sync('some-file-name')
|
||||
|
||||
// treat errors as just "not executable"
|
||||
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
|
||||
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `isexe(path, [options], [callback])`
|
||||
|
||||
Check if the path is executable. If no callback provided, and a
|
||||
global `Promise` object is available, then a Promise will be returned.
|
||||
|
||||
Will raise whatever errors may be raised by `fs.access` or `fs.stat`,
|
||||
unless `options.ignoreErrors` is set to true.
|
||||
|
||||
### `isexe.sync(path, [options])`
|
||||
|
||||
Same as `isexe` but returns the value and throws any errors raised.
|
15
src/test/fixtures/packagedDependencies/node_modules/isexe/access.js
generated
vendored
Normal file
15
src/test/fixtures/packagedDependencies/node_modules/isexe/access.js
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function isexe (path, cb) {
|
||||
fs.access(path, fs.X_OK, function (er) {
|
||||
cb(er, !er)
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path) {
|
||||
fs.accessSync(path, fs.X_OK)
|
||||
return true
|
||||
}
|
59
src/test/fixtures/packagedDependencies/node_modules/isexe/index.js
generated
vendored
Normal file
59
src/test/fixtures/packagedDependencies/node_modules/isexe/index.js
generated
vendored
Normal file
|
@ -0,0 +1,59 @@
|
|||
var fs = require('fs')
|
||||
var core
|
||||
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
||||
core = require('./windows.js')
|
||||
} else if (typeof fs.access === 'function') {
|
||||
core = require('./access.js')
|
||||
} else {
|
||||
core = require('./mode.js')
|
||||
}
|
||||
|
||||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
function isexe (path, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (!cb) {
|
||||
if (typeof Promise !== 'function') {
|
||||
throw new TypeError('callback not provided')
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
isexe(path, options, function (er, is) {
|
||||
if (er) {
|
||||
reject(er)
|
||||
} else {
|
||||
resolve(is)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
core(path, function (er, is) {
|
||||
// ignore EACCES because that just means we aren't allowed to run it
|
||||
if (er) {
|
||||
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
||||
er = null
|
||||
is = false
|
||||
}
|
||||
}
|
||||
cb(er, is)
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path, options) {
|
||||
// my kingdom for a filtered catch
|
||||
try {
|
||||
return core.sync(path)
|
||||
} catch (er) {
|
||||
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
||||
return false
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
31
src/test/fixtures/packagedDependencies/node_modules/isexe/mode.js
generated
vendored
Normal file
31
src/test/fixtures/packagedDependencies/node_modules/isexe/mode.js
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function isexe (path, cb) {
|
||||
fs.stat(path, function (er, st) {
|
||||
cb(er, er ? false : checkMode(st))
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path) {
|
||||
return checkMode(fs.statSync(path))
|
||||
}
|
||||
|
||||
function checkMode (stat) {
|
||||
var mod = stat.mode
|
||||
var uid = stat.uid
|
||||
var gid = stat.gid
|
||||
var u = parseInt('100', 8)
|
||||
var g = parseInt('010', 8)
|
||||
var o = parseInt('001', 8)
|
||||
var ug = u | g
|
||||
|
||||
var ret = (mod & o) ||
|
||||
(mod & g) && process.getgid && gid === process.getgid() ||
|
||||
(mod & u) && process.getuid && uid === process.getuid() ||
|
||||
(mod & ug) && process.getuid && process.getuid() === 0
|
||||
|
||||
return ret
|
||||
}
|
19
src/test/fixtures/packagedDependencies/node_modules/isexe/package.json
generated
vendored
Normal file
19
src/test/fixtures/packagedDependencies/node_modules/isexe/package.json
generated
vendored
Normal file
|
@ -0,0 +1,19 @@
|
|||
{
|
||||
"name": "isexe",
|
||||
"version": "1.0.0",
|
||||
"description": "Minimal module to check if a file is executable.",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
"rimraf": "^2.5.0",
|
||||
"tap": "^5.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC"
|
||||
}
|
132
src/test/fixtures/packagedDependencies/node_modules/isexe/test/basic.js
generated
vendored
Normal file
132
src/test/fixtures/packagedDependencies/node_modules/isexe/test/basic.js
generated
vendored
Normal file
|
@ -0,0 +1,132 @@
|
|||
var t = require('tap')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var fixture = path.resolve(__dirname, 'fixtures')
|
||||
var meow = fixture + '/meow.cat'
|
||||
var fail = fixture + '/fail.false'
|
||||
var noent = fixture + '/enoent.exe'
|
||||
var mkdirp = require('mkdirp')
|
||||
var rimraf = require('rimraf')
|
||||
|
||||
var isWindows = process.platform === 'win32'
|
||||
var hasAccess = typeof fs.access === 'function'
|
||||
var winSkip = isWindows && 'windows'
|
||||
var accessSkip = !hasAccess && 'no fs.access function'
|
||||
var hasPromise = typeof Promise === 'function'
|
||||
var promiseSkip = !hasPromise && 'no global Promise'
|
||||
|
||||
function reset () {
|
||||
delete require.cache[require.resolve('../')]
|
||||
return require('../')
|
||||
}
|
||||
|
||||
t.test('setup fixtures', function (t) {
|
||||
rimraf.sync(fixture)
|
||||
mkdirp.sync(fixture)
|
||||
fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n')
|
||||
fs.chmodSync(meow, parseInt('0755', 8))
|
||||
fs.writeFileSync(fail, '#!/usr/bin/env false\n')
|
||||
fs.chmodSync(fail, parseInt('0644', 8))
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('promise', { skip: promiseSkip }, function (t) {
|
||||
isexe = reset()
|
||||
t.test('meow async', function (t) {
|
||||
isexe(meow).then(function (is) {
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('fail async', function (t) {
|
||||
isexe(fail).then(function (is) {
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('noent async', function (t) {
|
||||
isexe(noent).catch(function (er) {
|
||||
t.ok(er)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('noent ignore async', function (t) {
|
||||
isexe(noent, { ignoreErrors: true }).then(function (is) {
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('access', { skip: accessSkip || winSkip }, function (t) {
|
||||
runTest(t)
|
||||
})
|
||||
|
||||
t.test('mode', { skip: winSkip }, function (t) {
|
||||
delete fs.access
|
||||
delete fs.accessSync
|
||||
runTest(t)
|
||||
})
|
||||
|
||||
t.test('windows', function (t) {
|
||||
global.TESTING_WINDOWS = true
|
||||
process.env.PATHEXT = '.EXE;.CAT;.CMD;.COM'
|
||||
runTest(t)
|
||||
})
|
||||
|
||||
t.test('cleanup', function (t) {
|
||||
rimraf.sync(fixture)
|
||||
t.end()
|
||||
})
|
||||
|
||||
function runTest (t) {
|
||||
var isexe = reset()
|
||||
|
||||
t.notOk(isexe.sync(fail))
|
||||
t.notOk(isexe.sync(noent, { ignoreErrors: true }))
|
||||
t.ok(isexe.sync(meow))
|
||||
t.throws(function () {
|
||||
isexe.sync(noent)
|
||||
})
|
||||
|
||||
t.test('meow async', function (t) {
|
||||
isexe(meow, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('fail async', function (t) {
|
||||
isexe(fail, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('noent async', function (t) {
|
||||
isexe(noent, function (er, is) {
|
||||
t.ok(er)
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('noent ignore async', function (t) {
|
||||
isexe(noent, { ignoreErrors: true }, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.end()
|
||||
}
|
30
src/test/fixtures/packagedDependencies/node_modules/isexe/windows.js
generated
vendored
Normal file
30
src/test/fixtures/packagedDependencies/node_modules/isexe/windows.js
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function checkPathExt (path) {
|
||||
var pathext = process.env.PATHEXT
|
||||
if (!pathext) {
|
||||
return true
|
||||
}
|
||||
pathext = pathext.split(';')
|
||||
for (var i = 0; i < pathext.length; i++) {
|
||||
var p = pathext[i].toLowerCase()
|
||||
if (p && path.substr(-p.length).toLowerCase() === p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function isexe (path, cb) {
|
||||
fs.stat(path, function (er, st) {
|
||||
cb(er, er ? false : checkPathExt(path))
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path) {
|
||||
fs.statSync(path)
|
||||
return checkPathExt(path)
|
||||
}
|
152
src/test/fixtures/packagedDependencies/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
152
src/test/fixtures/packagedDependencies/node_modules/which/CHANGELOG.md
generated
vendored
Normal file
|
@ -0,0 +1,152 @@
|
|||
# Changes
|
||||
|
||||
|
||||
## 1.3.1
|
||||
|
||||
* update deps
|
||||
* update travis
|
||||
|
||||
## v1.3.0
|
||||
|
||||
* Add nothrow option to which.sync
|
||||
* update tap
|
||||
|
||||
## v1.2.14
|
||||
|
||||
* appveyor: drop node 5 and 0.x
|
||||
* travis-ci: add node 6, drop 0.x
|
||||
|
||||
## v1.2.13
|
||||
|
||||
* test: Pass missing option to pass on windows
|
||||
* update tap
|
||||
* update isexe to 2.0.0
|
||||
* neveragain.tech pledge request
|
||||
|
||||
## v1.2.12
|
||||
|
||||
* Removed unused require
|
||||
|
||||
## v1.2.11
|
||||
|
||||
* Prevent changelog script from being included in package
|
||||
|
||||
## v1.2.10
|
||||
|
||||
* Use env.PATH only, not env.Path
|
||||
|
||||
## v1.2.9
|
||||
|
||||
* fix for paths starting with ../
|
||||
* Remove unused `is-absolute` module
|
||||
|
||||
## v1.2.8
|
||||
|
||||
* bullet items in changelog that contain (but don't start with) #
|
||||
|
||||
## v1.2.7
|
||||
|
||||
* strip 'update changelog' changelog entries out of changelog
|
||||
|
||||
## v1.2.6
|
||||
|
||||
* make the changelog bulleted
|
||||
|
||||
## v1.2.5
|
||||
|
||||
* make a changelog, and keep it up to date
|
||||
* don't include tests in package
|
||||
* Properly handle relative-path executables
|
||||
* appveyor
|
||||
* Attach error code to Not Found error
|
||||
* Make tests pass on Windows
|
||||
|
||||
## v1.2.4
|
||||
|
||||
* Fix typo
|
||||
|
||||
## v1.2.3
|
||||
|
||||
* update isexe, fix regression in pathExt handling
|
||||
|
||||
## v1.2.2
|
||||
|
||||
* update deps, use isexe module, test windows
|
||||
|
||||
## v1.2.1
|
||||
|
||||
* Sometimes windows PATH entries are quoted
|
||||
* Fixed a bug in the check for group and user mode bits. This bug was introduced during refactoring for supporting strict mode.
|
||||
* doc cli
|
||||
|
||||
## v1.2.0
|
||||
|
||||
* Add support for opt.all and -as cli flags
|
||||
* test the bin
|
||||
* update travis
|
||||
* Allow checking for multiple programs in bin/which
|
||||
* tap 2
|
||||
|
||||
## v1.1.2
|
||||
|
||||
* travis
|
||||
* Refactored and fixed undefined error on Windows
|
||||
* Support strict mode
|
||||
|
||||
## v1.1.1
|
||||
|
||||
* test +g exes against secondary groups, if available
|
||||
* Use windows exe semantics on cygwin & msys
|
||||
* cwd should be first in path on win32, not last
|
||||
* Handle lower-case 'env.Path' on Windows
|
||||
* Update docs
|
||||
* use single-quotes
|
||||
|
||||
## v1.1.0
|
||||
|
||||
* Add tests, depend on is-absolute
|
||||
|
||||
## v1.0.9
|
||||
|
||||
* which.js: root is allowed to execute files owned by anyone
|
||||
|
||||
## v1.0.8
|
||||
|
||||
* don't use graceful-fs
|
||||
|
||||
## v1.0.7
|
||||
|
||||
* add license to package.json
|
||||
|
||||
## v1.0.6
|
||||
|
||||
* isc license
|
||||
|
||||
## 1.0.5
|
||||
|
||||
* Awful typo
|
||||
|
||||
## 1.0.4
|
||||
|
||||
* Test for path absoluteness properly
|
||||
* win: Allow '' as a pathext if cmd has a . in it
|
||||
|
||||
## 1.0.3
|
||||
|
||||
* Remove references to execPath
|
||||
* Make `which.sync()` work on Windows by honoring the PATHEXT variable.
|
||||
* Make `isExe()` always return true on Windows.
|
||||
* MIT
|
||||
|
||||
## 1.0.2
|
||||
|
||||
* Only files can be exes
|
||||
|
||||
## 1.0.1
|
||||
|
||||
* Respect the PATHEXT env for win32 support
|
||||
* should 0755 the bin
|
||||
* binary
|
||||
* guts
|
||||
* package
|
||||
* 1st
|
15
src/test/fixtures/packagedDependencies/node_modules/which/LICENSE
generated
vendored
Normal file
15
src/test/fixtures/packagedDependencies/node_modules/which/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
51
src/test/fixtures/packagedDependencies/node_modules/which/README.md
generated
vendored
Normal file
51
src/test/fixtures/packagedDependencies/node_modules/which/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# which
|
||||
|
||||
Like the unix `which` utility.
|
||||
|
||||
Finds the first instance of a specified executable in the PATH
|
||||
environment variable. Does not cache the results, so `hash -r` is not
|
||||
needed when the PATH changes.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var which = require('which')
|
||||
|
||||
// async usage
|
||||
which('node', function (er, resolvedPath) {
|
||||
// er is returned if no "node" is found on the PATH
|
||||
// if it is found, then the absolute path to the exec is returned
|
||||
})
|
||||
|
||||
// sync usage
|
||||
// throws if not found
|
||||
var resolved = which.sync('node')
|
||||
|
||||
// if nothrow option is used, returns null if not found
|
||||
resolved = which.sync('node', {nothrow: true})
|
||||
|
||||
// Pass options to override the PATH and PATHEXT environment vars.
|
||||
which('node', { path: someOtherPath }, function (er, resolved) {
|
||||
if (er)
|
||||
throw er
|
||||
console.log('found at %j', resolved)
|
||||
})
|
||||
```
|
||||
|
||||
## CLI USAGE
|
||||
|
||||
Same as the BSD `which(1)` binary.
|
||||
|
||||
```
|
||||
usage: which [-as] program ...
|
||||
```
|
||||
|
||||
## OPTIONS
|
||||
|
||||
You may pass an options object as the second argument.
|
||||
|
||||
- `path`: Use instead of the `PATH` environment variable.
|
||||
- `pathExt`: Use instead of the `PATHEXT` environment variable.
|
||||
- `all`: Return all matches, instead of just the first one. Note that
|
||||
this means the function returns an array of strings instead of a
|
||||
single string.
|
52
src/test/fixtures/packagedDependencies/node_modules/which/bin/which
generated
vendored
Executable file
52
src/test/fixtures/packagedDependencies/node_modules/which/bin/which
generated
vendored
Executable file
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/env node
|
||||
var which = require("../")
|
||||
if (process.argv.length < 3)
|
||||
usage()
|
||||
|
||||
function usage () {
|
||||
console.error('usage: which [-as] program ...')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
var all = false
|
||||
var silent = false
|
||||
var dashdash = false
|
||||
var args = process.argv.slice(2).filter(function (arg) {
|
||||
if (dashdash || !/^-/.test(arg))
|
||||
return true
|
||||
|
||||
if (arg === '--') {
|
||||
dashdash = true
|
||||
return false
|
||||
}
|
||||
|
||||
var flags = arg.substr(1).split('')
|
||||
for (var f = 0; f < flags.length; f++) {
|
||||
var flag = flags[f]
|
||||
switch (flag) {
|
||||
case 's':
|
||||
silent = true
|
||||
break
|
||||
case 'a':
|
||||
all = true
|
||||
break
|
||||
default:
|
||||
console.error('which: illegal option -- ' + flag)
|
||||
usage()
|
||||
}
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
process.exit(args.reduce(function (pv, current) {
|
||||
try {
|
||||
var f = which.sync(current, { all: all })
|
||||
if (all)
|
||||
f = f.join('\n')
|
||||
if (!silent)
|
||||
console.log(f)
|
||||
return pv;
|
||||
} catch (e) {
|
||||
return 1;
|
||||
}
|
||||
}, 0))
|
2
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/.npmignore
generated
vendored
Normal file
2
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/.npmignore
generated
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
.nyc_output/
|
||||
coverage/
|
15
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/LICENSE
generated
vendored
Normal file
15
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/LICENSE
generated
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
51
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/README.md
generated
vendored
Normal file
51
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/README.md
generated
vendored
Normal file
|
@ -0,0 +1,51 @@
|
|||
# isexe
|
||||
|
||||
Minimal module to check if a file is executable, and a normal file.
|
||||
|
||||
Uses `fs.stat` and tests against the `PATHEXT` environment variable on
|
||||
Windows.
|
||||
|
||||
## USAGE
|
||||
|
||||
```javascript
|
||||
var isexe = require('isexe')
|
||||
isexe('some-file-name', function (err, isExe) {
|
||||
if (err) {
|
||||
console.error('probably file does not exist or something', err)
|
||||
} else if (isExe) {
|
||||
console.error('this thing can be run')
|
||||
} else {
|
||||
console.error('cannot be run')
|
||||
}
|
||||
})
|
||||
|
||||
// same thing but synchronous, throws errors
|
||||
var isExe = isexe.sync('some-file-name')
|
||||
|
||||
// treat errors as just "not executable"
|
||||
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
|
||||
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
|
||||
```
|
||||
|
||||
## API
|
||||
|
||||
### `isexe(path, [options], [callback])`
|
||||
|
||||
Check if the path is executable. If no callback provided, and a
|
||||
global `Promise` object is available, then a Promise will be returned.
|
||||
|
||||
Will raise whatever errors may be raised by `fs.stat`, unless
|
||||
`options.ignoreErrors` is set to true.
|
||||
|
||||
### `isexe.sync(path, [options])`
|
||||
|
||||
Same as `isexe` but returns the value and throws any errors raised.
|
||||
|
||||
### Options
|
||||
|
||||
* `ignoreErrors` Treat all errors as "no, this is not executable", but
|
||||
don't raise them.
|
||||
* `uid` Number to use as the user id
|
||||
* `gid` Number to use as the group id
|
||||
* `pathExt` List of path extensions to use instead of `PATHEXT`
|
||||
environment variable on Windows.
|
57
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/index.js
generated
vendored
Normal file
57
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/index.js
generated
vendored
Normal file
|
@ -0,0 +1,57 @@
|
|||
var fs = require('fs')
|
||||
var core
|
||||
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
|
||||
core = require('./windows.js')
|
||||
} else {
|
||||
core = require('./mode.js')
|
||||
}
|
||||
|
||||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
function isexe (path, options, cb) {
|
||||
if (typeof options === 'function') {
|
||||
cb = options
|
||||
options = {}
|
||||
}
|
||||
|
||||
if (!cb) {
|
||||
if (typeof Promise !== 'function') {
|
||||
throw new TypeError('callback not provided')
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
isexe(path, options || {}, function (er, is) {
|
||||
if (er) {
|
||||
reject(er)
|
||||
} else {
|
||||
resolve(is)
|
||||
}
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
core(path, options || {}, function (er, is) {
|
||||
// ignore EACCES because that just means we aren't allowed to run it
|
||||
if (er) {
|
||||
if (er.code === 'EACCES' || options && options.ignoreErrors) {
|
||||
er = null
|
||||
is = false
|
||||
}
|
||||
}
|
||||
cb(er, is)
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path, options) {
|
||||
// my kingdom for a filtered catch
|
||||
try {
|
||||
return core.sync(path, options || {})
|
||||
} catch (er) {
|
||||
if (options && options.ignoreErrors || er.code === 'EACCES') {
|
||||
return false
|
||||
} else {
|
||||
throw er
|
||||
}
|
||||
}
|
||||
}
|
41
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/mode.js
generated
vendored
Normal file
41
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/mode.js
generated
vendored
Normal file
|
@ -0,0 +1,41 @@
|
|||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function isexe (path, options, cb) {
|
||||
fs.stat(path, function (er, stat) {
|
||||
cb(er, er ? false : checkStat(stat, options))
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path, options) {
|
||||
return checkStat(fs.statSync(path), options)
|
||||
}
|
||||
|
||||
function checkStat (stat, options) {
|
||||
return stat.isFile() && checkMode(stat, options)
|
||||
}
|
||||
|
||||
function checkMode (stat, options) {
|
||||
var mod = stat.mode
|
||||
var uid = stat.uid
|
||||
var gid = stat.gid
|
||||
|
||||
var myUid = options.uid !== undefined ?
|
||||
options.uid : process.getuid && process.getuid()
|
||||
var myGid = options.gid !== undefined ?
|
||||
options.gid : process.getgid && process.getgid()
|
||||
|
||||
var u = parseInt('100', 8)
|
||||
var g = parseInt('010', 8)
|
||||
var o = parseInt('001', 8)
|
||||
var ug = u | g
|
||||
|
||||
var ret = (mod & o) ||
|
||||
(mod & g) && gid === myGid ||
|
||||
(mod & u) && uid === myUid ||
|
||||
(mod & ug) && myUid === 0
|
||||
|
||||
return ret
|
||||
}
|
31
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/package.json
generated
vendored
Normal file
31
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/package.json
generated
vendored
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "isexe",
|
||||
"version": "2.0.0",
|
||||
"description": "Minimal module to check if a file is executable.",
|
||||
"main": "index.js",
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.1",
|
||||
"rimraf": "^2.5.0",
|
||||
"tap": "^10.3.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --100",
|
||||
"preversion": "npm test",
|
||||
"postversion": "npm publish",
|
||||
"postpublish": "git push origin --all; git push origin --tags"
|
||||
},
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me/)",
|
||||
"license": "ISC",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/isaacs/isexe.git"
|
||||
},
|
||||
"keywords": [],
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/isexe/issues"
|
||||
},
|
||||
"homepage": "https://github.com/isaacs/isexe#readme"
|
||||
}
|
221
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/test/basic.js
generated
vendored
Normal file
221
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/test/basic.js
generated
vendored
Normal file
|
@ -0,0 +1,221 @@
|
|||
var t = require('tap')
|
||||
var fs = require('fs')
|
||||
var path = require('path')
|
||||
var fixture = path.resolve(__dirname, 'fixtures')
|
||||
var meow = fixture + '/meow.cat'
|
||||
var mine = fixture + '/mine.cat'
|
||||
var ours = fixture + '/ours.cat'
|
||||
var fail = fixture + '/fail.false'
|
||||
var noent = fixture + '/enoent.exe'
|
||||
var mkdirp = require('mkdirp')
|
||||
var rimraf = require('rimraf')
|
||||
|
||||
var isWindows = process.platform === 'win32'
|
||||
var hasAccess = typeof fs.access === 'function'
|
||||
var winSkip = isWindows && 'windows'
|
||||
var accessSkip = !hasAccess && 'no fs.access function'
|
||||
var hasPromise = typeof Promise === 'function'
|
||||
var promiseSkip = !hasPromise && 'no global Promise'
|
||||
|
||||
function reset () {
|
||||
delete require.cache[require.resolve('../')]
|
||||
return require('../')
|
||||
}
|
||||
|
||||
t.test('setup fixtures', function (t) {
|
||||
rimraf.sync(fixture)
|
||||
mkdirp.sync(fixture)
|
||||
fs.writeFileSync(meow, '#!/usr/bin/env cat\nmeow\n')
|
||||
fs.chmodSync(meow, parseInt('0755', 8))
|
||||
fs.writeFileSync(fail, '#!/usr/bin/env false\n')
|
||||
fs.chmodSync(fail, parseInt('0644', 8))
|
||||
fs.writeFileSync(mine, '#!/usr/bin/env cat\nmine\n')
|
||||
fs.chmodSync(mine, parseInt('0744', 8))
|
||||
fs.writeFileSync(ours, '#!/usr/bin/env cat\nours\n')
|
||||
fs.chmodSync(ours, parseInt('0754', 8))
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('promise', { skip: promiseSkip }, function (t) {
|
||||
var isexe = reset()
|
||||
t.test('meow async', function (t) {
|
||||
isexe(meow).then(function (is) {
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('fail async', function (t) {
|
||||
isexe(fail).then(function (is) {
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('noent async', function (t) {
|
||||
isexe(noent).catch(function (er) {
|
||||
t.ok(er)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.test('noent ignore async', function (t) {
|
||||
isexe(noent, { ignoreErrors: true }).then(function (is) {
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('no promise', function (t) {
|
||||
global.Promise = null
|
||||
var isexe = reset()
|
||||
t.throws('try to meow a promise', function () {
|
||||
isexe(meow)
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('access', { skip: accessSkip || winSkip }, function (t) {
|
||||
runTest(t)
|
||||
})
|
||||
|
||||
t.test('mode', { skip: winSkip }, function (t) {
|
||||
delete fs.access
|
||||
delete fs.accessSync
|
||||
var isexe = reset()
|
||||
t.ok(isexe.sync(ours, { uid: 0, gid: 0 }))
|
||||
t.ok(isexe.sync(mine, { uid: 0, gid: 0 }))
|
||||
runTest(t)
|
||||
})
|
||||
|
||||
t.test('windows', function (t) {
|
||||
global.TESTING_WINDOWS = true
|
||||
var pathExt = '.EXE;.CAT;.CMD;.COM'
|
||||
t.test('pathExt option', function (t) {
|
||||
runTest(t, { pathExt: '.EXE;.CAT;.CMD;.COM' })
|
||||
})
|
||||
t.test('pathExt env', function (t) {
|
||||
process.env.PATHEXT = pathExt
|
||||
runTest(t)
|
||||
})
|
||||
t.test('no pathExt', function (t) {
|
||||
// with a pathExt of '', any filename is fine.
|
||||
// so the "fail" one would still pass.
|
||||
runTest(t, { pathExt: '', skipFail: true })
|
||||
})
|
||||
t.test('pathext with empty entry', function (t) {
|
||||
// with a pathExt of '', any filename is fine.
|
||||
// so the "fail" one would still pass.
|
||||
runTest(t, { pathExt: ';' + pathExt, skipFail: true })
|
||||
})
|
||||
t.end()
|
||||
})
|
||||
|
||||
t.test('cleanup', function (t) {
|
||||
rimraf.sync(fixture)
|
||||
t.end()
|
||||
})
|
||||
|
||||
function runTest (t, options) {
|
||||
var isexe = reset()
|
||||
|
||||
var optionsIgnore = Object.create(options || {})
|
||||
optionsIgnore.ignoreErrors = true
|
||||
|
||||
if (!options || !options.skipFail) {
|
||||
t.notOk(isexe.sync(fail, options))
|
||||
}
|
||||
t.notOk(isexe.sync(noent, optionsIgnore))
|
||||
if (!options) {
|
||||
t.ok(isexe.sync(meow))
|
||||
} else {
|
||||
t.ok(isexe.sync(meow, options))
|
||||
}
|
||||
|
||||
t.ok(isexe.sync(mine, options))
|
||||
t.ok(isexe.sync(ours, options))
|
||||
t.throws(function () {
|
||||
isexe.sync(noent, options)
|
||||
})
|
||||
|
||||
t.test('meow async', function (t) {
|
||||
if (!options) {
|
||||
isexe(meow, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
} else {
|
||||
isexe(meow, options, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
}
|
||||
})
|
||||
|
||||
t.test('mine async', function (t) {
|
||||
isexe(mine, options, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('ours async', function (t) {
|
||||
isexe(ours, options, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.ok(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
if (!options || !options.skipFail) {
|
||||
t.test('fail async', function (t) {
|
||||
isexe(fail, options, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
t.test('noent async', function (t) {
|
||||
isexe(noent, options, function (er, is) {
|
||||
t.ok(er)
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('noent ignore async', function (t) {
|
||||
isexe(noent, optionsIgnore, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.test('directory is not executable', function (t) {
|
||||
isexe(__dirname, options, function (er, is) {
|
||||
if (er) {
|
||||
throw er
|
||||
}
|
||||
t.notOk(is)
|
||||
t.end()
|
||||
})
|
||||
})
|
||||
|
||||
t.end()
|
||||
}
|
42
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/windows.js
generated
vendored
Normal file
42
src/test/fixtures/packagedDependencies/node_modules/which/node_modules/isexe/windows.js
generated
vendored
Normal file
|
@ -0,0 +1,42 @@
|
|||
module.exports = isexe
|
||||
isexe.sync = sync
|
||||
|
||||
var fs = require('fs')
|
||||
|
||||
function checkPathExt (path, options) {
|
||||
var pathext = options.pathExt !== undefined ?
|
||||
options.pathExt : process.env.PATHEXT
|
||||
|
||||
if (!pathext) {
|
||||
return true
|
||||
}
|
||||
|
||||
pathext = pathext.split(';')
|
||||
if (pathext.indexOf('') !== -1) {
|
||||
return true
|
||||
}
|
||||
for (var i = 0; i < pathext.length; i++) {
|
||||
var p = pathext[i].toLowerCase()
|
||||
if (p && path.substr(-p.length).toLowerCase() === p) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
function checkStat (stat, path, options) {
|
||||
if (!stat.isSymbolicLink() && !stat.isFile()) {
|
||||
return false
|
||||
}
|
||||
return checkPathExt(path, options)
|
||||
}
|
||||
|
||||
function isexe (path, options, cb) {
|
||||
fs.stat(path, function (er, stat) {
|
||||
cb(er, er ? false : checkStat(stat, path, options))
|
||||
})
|
||||
}
|
||||
|
||||
function sync (path, options) {
|
||||
return checkStat(fs.statSync(path), path, options)
|
||||
}
|
30
src/test/fixtures/packagedDependencies/node_modules/which/package.json
generated
vendored
Normal file
30
src/test/fixtures/packagedDependencies/node_modules/which/package.json
generated
vendored
Normal file
|
@ -0,0 +1,30 @@
|
|||
{
|
||||
"author": "Isaac Z. Schlueter <i@izs.me> (http://blog.izs.me)",
|
||||
"name": "which",
|
||||
"description": "Like which(1) unix command. Find the first instance of an executable in the PATH.",
|
||||
"version": "1.3.1",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/node-which.git"
|
||||
},
|
||||
"main": "which.js",
|
||||
"bin": "./bin/which",
|
||||
"license": "ISC",
|
||||
"dependencies": {
|
||||
"isexe": "^2.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mkdirp": "^0.5.0",
|
||||
"rimraf": "^2.6.2",
|
||||
"tap": "^12.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov",
|
||||
"changelog": "bash gen-changelog.sh",
|
||||
"postversion": "npm run changelog && git add CHANGELOG.md && git commit -m 'update changelog - '${npm_package_version}"
|
||||
},
|
||||
"files": [
|
||||
"which.js",
|
||||
"bin/which"
|
||||
]
|
||||
}
|
135
src/test/fixtures/packagedDependencies/node_modules/which/which.js
generated
vendored
Normal file
135
src/test/fixtures/packagedDependencies/node_modules/which/which.js
generated
vendored
Normal file
|
@ -0,0 +1,135 @@
|
|||
module.exports = which
|
||||
which.sync = whichSync
|
||||
|
||||
var isWindows = process.platform === 'win32' ||
|
||||
process.env.OSTYPE === 'cygwin' ||
|
||||
process.env.OSTYPE === 'msys'
|
||||
|
||||
var path = require('path')
|
||||
var COLON = isWindows ? ';' : ':'
|
||||
var isexe = require('isexe')
|
||||
|
||||
function getNotFoundError (cmd) {
|
||||
var er = new Error('not found: ' + cmd)
|
||||
er.code = 'ENOENT'
|
||||
|
||||
return er
|
||||
}
|
||||
|
||||
function getPathInfo (cmd, opt) {
|
||||
var colon = opt.colon || COLON
|
||||
var pathEnv = opt.path || process.env.PATH || ''
|
||||
var pathExt = ['']
|
||||
|
||||
pathEnv = pathEnv.split(colon)
|
||||
|
||||
var pathExtExe = ''
|
||||
if (isWindows) {
|
||||
pathEnv.unshift(process.cwd())
|
||||
pathExtExe = (opt.pathExt || process.env.PATHEXT || '.EXE;.CMD;.BAT;.COM')
|
||||
pathExt = pathExtExe.split(colon)
|
||||
|
||||
|
||||
// Always test the cmd itself first. isexe will check to make sure
|
||||
// it's found in the pathExt set.
|
||||
if (cmd.indexOf('.') !== -1 && pathExt[0] !== '')
|
||||
pathExt.unshift('')
|
||||
}
|
||||
|
||||
// If it has a slash, then we don't bother searching the pathenv.
|
||||
// just check the file itself, and that's it.
|
||||
if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
|
||||
pathEnv = ['']
|
||||
|
||||
return {
|
||||
env: pathEnv,
|
||||
ext: pathExt,
|
||||
extExe: pathExtExe
|
||||
}
|
||||
}
|
||||
|
||||
function which (cmd, opt, cb) {
|
||||
if (typeof opt === 'function') {
|
||||
cb = opt
|
||||
opt = {}
|
||||
}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
;(function F (i, l) {
|
||||
if (i === l) {
|
||||
if (opt.all && found.length)
|
||||
return cb(null, found)
|
||||
else
|
||||
return cb(getNotFoundError(cmd))
|
||||
}
|
||||
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && (/^\.[\\\/]/).test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
;(function E (ii, ll) {
|
||||
if (ii === ll) return F(i + 1, l)
|
||||
var ext = pathExt[ii]
|
||||
isexe(p + ext, { pathExt: pathExtExe }, function (er, is) {
|
||||
if (!er && is) {
|
||||
if (opt.all)
|
||||
found.push(p + ext)
|
||||
else
|
||||
return cb(null, p + ext)
|
||||
}
|
||||
return E(ii + 1, ll)
|
||||
})
|
||||
})(0, pathExt.length)
|
||||
})(0, pathEnv.length)
|
||||
}
|
||||
|
||||
function whichSync (cmd, opt) {
|
||||
opt = opt || {}
|
||||
|
||||
var info = getPathInfo(cmd, opt)
|
||||
var pathEnv = info.env
|
||||
var pathExt = info.ext
|
||||
var pathExtExe = info.extExe
|
||||
var found = []
|
||||
|
||||
for (var i = 0, l = pathEnv.length; i < l; i ++) {
|
||||
var pathPart = pathEnv[i]
|
||||
if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
|
||||
pathPart = pathPart.slice(1, -1)
|
||||
|
||||
var p = path.join(pathPart, cmd)
|
||||
if (!pathPart && /^\.[\\\/]/.test(cmd)) {
|
||||
p = cmd.slice(0, 2) + p
|
||||
}
|
||||
for (var j = 0, ll = pathExt.length; j < ll; j ++) {
|
||||
var cur = p + pathExt[j]
|
||||
var is
|
||||
try {
|
||||
is = isexe.sync(cur, { pathExt: pathExtExe })
|
||||
if (is) {
|
||||
if (opt.all)
|
||||
found.push(cur)
|
||||
else
|
||||
return cur
|
||||
}
|
||||
} catch (ex) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (opt.all && found.length)
|
||||
return found
|
||||
|
||||
if (opt.nothrow)
|
||||
return null
|
||||
|
||||
throw getNotFoundError(cmd)
|
||||
}
|
15
src/test/fixtures/packagedDependencies/package.json
vendored
Normal file
15
src/test/fixtures/packagedDependencies/package.json
vendored
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "root-test-package",
|
||||
"publisher": "jrieken",
|
||||
"version": "1.0.0",
|
||||
"engines": {
|
||||
"vscode": "*"
|
||||
},
|
||||
"dependencies": {
|
||||
"isexe": "1.0.0",
|
||||
"which": "1.3.1"
|
||||
},
|
||||
"vscode:packagedDependencies": [
|
||||
"isexe"
|
||||
]
|
||||
}
|
17
src/test/fixtures/packagedDependencies/yarn.lock
vendored
Normal file
17
src/test/fixtures/packagedDependencies/yarn.lock
vendored
Normal file
|
@ -0,0 +1,17 @@
|
|||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
isexe@1.0.0:
|
||||
version "1.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-1.0.0.tgz#9aa37a1d11d27b523bec4f8791b72af1ead44ee3"
|
||||
|
||||
isexe@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/isexe/-/isexe-2.0.0.tgz#e8fbf374dc556ff8947a10dcb0572d633f2cfa10"
|
||||
|
||||
which@1.3.1:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a"
|
||||
dependencies:
|
||||
isexe "^2.0.0"
|
|
@ -176,6 +176,24 @@ describe('collect', function () {
|
|||
assert.equal(files.filter(f => /\.vsixmanifest$/.test(f.path)).length, 1);
|
||||
});
|
||||
});
|
||||
|
||||
it('should honor vscode:packagedDependencies', () => {
|
||||
|
||||
const cwd = fixture('packagedDependencies');
|
||||
return readManifest(cwd)
|
||||
.then(manifest => collect(manifest, { cwd, useYarn: true }))
|
||||
.then(files => {
|
||||
let seenWhich: boolean;
|
||||
let seenIsexe: boolean;
|
||||
files.forEach(file => {
|
||||
seenWhich = file.path.indexOf('/node_modules/which/') >= 0;
|
||||
seenIsexe = file.path.indexOf('/node_modules/isexe/') >= 0;
|
||||
});
|
||||
assert.equal(seenWhich, false);
|
||||
assert.equal(seenIsexe, true);
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
describe('readManifest', () => {
|
||||
|
@ -1517,4 +1535,4 @@ describe('MarkdownProcessor', () => {
|
|||
|
||||
await throws(() => processor.onFile(readme));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue