structure, layout and automation

This commit is contained in:
Tancre
2020-09-16 14:23:28 +02:00
commit 0efda7fffe
15549 changed files with 1280031 additions and 0 deletions

164
node_modules/node-gyp/test/docker.sh generated vendored Executable file
View File

@ -0,0 +1,164 @@
#!/bin/bash
#set -e
test_node_versions="0.8.28 0.10.40 0.12.7 4.3.0 5.6.0"
test_iojs_versions="1.8.4 2.4.0 3.3.0"
myuid=$(id -u)
mygid=$(id -g)
__dirname="$(CDPATH= cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
dot_node_gyp=${__dirname}/.node-gyp/
# borrows from https://github.com/rvagg/dnt/
# Simple setup function for a container:
# setup_container(image id, base image, commands to run to set up)
setup_container() {
local container_id="$1"
local base_container="$2"
local run_cmd="$3"
# Does this image exist? If yes, ignore
docker inspect "$container_id" &> /dev/null
if [[ $? -eq 0 ]]; then
echo "Found existing container [$container_id]"
else
# No such image, so make it
echo "Did not find container [$container_id], creating..."
docker run -i $base_container /bin/bash -c "$run_cmd"
sleep 2
docker commit $(docker ps -l -q) $container_id
fi
}
# Run tests inside each of the versioned containers, copy cwd into npm's copy of node-gyp
# so it'll be invoked by npm when a compile is needed
# run_tests(version, test-commands)
run_tests() {
local version="$1"
local run_cmd="$2"
run_cmd="rsync -aAXx --delete --exclude .git --exclude build /node-gyp-src/ /usr/lib/node_modules/npm/node_modules/node-gyp/;
/bin/su -s /bin/bash node-gyp -c 'cd && ${run_cmd}'"
rm -rf $dot_node_gyp
mkdir $dot_node_gyp
docker run \
--rm -i \
-v ~/.npm/:/node-gyp/.npm/ \
-v ${dot_node_gyp}:/node-gyp/.node-gyp/ \
-v $(pwd):/node-gyp-src/:ro \
node-gyp-test/${version} /bin/bash -c "${run_cmd}"
}
# A base image with build tools and a user account
setup_container "node-gyp-test/base" "ubuntu:14.04" "
adduser --gecos node-gyp --home /node-gyp/ --disabled-login node-gyp --uid $myuid &&
echo "node-gyp:node-gyp" | chpasswd &&
apt-get update &&
apt-get install -y build-essential python git rsync curl
"
# An image on top of the base containing clones of repos we want to use for testing
setup_container "node-gyp-test/clones" "node-gyp-test/base" "
cd /node-gyp/ && git clone https://github.com/justmoon/node-bignum.git &&
cd /node-gyp/ && git clone https://github.com/bnoordhuis/node-buffertools.git &&
chown -R node-gyp.node-gyp /node-gyp/
"
# An image for each of the node versions we want to test with that version installed and the latest npm
for v in $test_node_versions; do
setup_container "node-gyp-test/${v}" "node-gyp-test/clones" "
curl -sL https://nodejs.org/dist/v${v}/node-v${v}-linux-x64.tar.gz | tar -zxv --strip-components=1 -C /usr/ &&
npm install npm@latest -g &&
node -v && npm -v
"
done
# An image for each of the io.js versions we want to test with that version installed and the latest npm
for v in $test_iojs_versions; do
setup_container "node-gyp-test/${v}" "node-gyp-test/clones" "
curl -sL https://iojs.org/dist/v${v}/iojs-v${v}-linux-x64.tar.gz | tar -zxv --strip-components=1 -C /usr/ &&
npm install npm@latest -g &&
node -v && npm -v
"
done
# Run the tests for all of the test images we've created,
# we should see node-gyp doing its download, configure and run thing
# _NOTE: bignum doesn't compile on 0.8 currently so it'll fail for that version only_
for v in $test_node_versions $test_iojs_versions; do
run_tests $v "
cd node-buffertools && npm install --loglevel=info && npm test && cd
"
# removed for now, too noisy: cd node-bignum && npm install --loglevel=info && npm test
done
# Test use of --target=x.y.z to compile against alternate versions
test_download_node_version() {
local run_with_ver="$1"
local expected_dir="$2"
local expected_ver="$3"
run_tests $run_with_ver "cd node-buffertools && npm install --loglevel=info --target=${expected_ver}"
local node_ver=$(cat "${dot_node_gyp}${expected_dir}/node_version.h" | grep '#define NODE_\w*_VERSION [0-9]*$')
node_ver=$(echo $node_ver | sed 's/#define NODE_[A-Z]*_VERSION //g' | sed 's/ /./g')
if [ "X$(echo $node_ver)" != "X${expected_ver}" ]; then
echo "Did not download v${expected_ver} using --target, instead got: $(echo $node_ver)"
exit 1
fi
echo "Verified correct download of [v${node_ver}]"
}
test_download_node_version "0.12.7" "0.10.30/src" "0.10.30"
test_download_node_version "3.3.0" "iojs-1.8.4/src" "1.8.4"
# should download the headers file
test_download_node_version "3.3.0" "iojs-3.3.0/include/node" "3.3.0"
test_download_node_version "4.3.0" "4.3.0/include/node" "4.3.0"
test_download_node_version "5.6.0" "5.6.0/include/node" "5.6.0"
# TODO: test --dist-url by starting up a localhost server and serving up tarballs
# testing --dist-url, using simple-proxy.js to make localhost work as a distribution
# point for tarballs
# we can test whether it uses the proxy because after 2 connections the proxy will
# die and therefore should not be running at the end of the test, `nc` can tell us this
run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /foobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
/node-gyp-src/bin/node-gyp.js --loglevel=info --dist-url=http://localhost:8080/foobar/ rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"
# REMOVE after next semver-major
run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /doobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
NVM_IOJS_ORG_MIRROR=http://localhost:8080/doobar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"
# REMOVE after next semver-major
run_tests "0.12.7" "
(node /node-gyp-src/test/simple-proxy.js 8080 /boombar/ https://nodejs.org/dist/ &) &&
cd node-buffertools &&
NVM_NODEJS_ORG_MIRROR=http://localhost:8080/boombar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"
run_tests "3.3.0" "
(node /node-gyp-src/test/simple-proxy.js 8080 /doobar/ https://iojs.org/dist/ &) &&
cd node-buffertools &&
IOJS_ORG_MIRROR=http://localhost:8080/doobar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"
run_tests "0.12.7" "
(node /node-gyp-src/test/simple-proxy.js 8080 /boombar/ https://nodejs.org/dist/ &) &&
cd node-buffertools &&
NODEJS_ORG_MIRROR=http://localhost:8080/boombar/ /node-gyp-src/bin/node-gyp.js --loglevel=info rebuild &&
nc -z localhost 8080 && echo -e \"\\n\\n\\033[31mFAILED TO USE LOCAL PROXY\\033[39m\\n\\n\"
"
rm -rf $dot_node_gyp

40
node_modules/node-gyp/test/fixtures/ca-bundle.crt generated vendored Normal file
View File

@ -0,0 +1,40 @@
-----BEGIN CERTIFICATE-----
MIIDJjCCAg4CAhnOMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n
TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv
bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMBkxFzAV
BgNVBAMMDnN0cm9uZ2xvb3AuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAwOYI7OZ2FX/YjRgLZoDQlbPc5UZXU/j0e1wwiJNPtPEax9Y5Uoza0Pnt
Ikzkc2SfvQ+IJrhXo385tI0W5juuqbHnE7UrjUuPjUX6NHevkxcs/flmjan5wnZM
cPsGhH71WDuUEEflvZihf2Se2x+xgZtMhc5XGmVmRuZFYKvkgUhA2/w8/QrK+jPT
n9QRJxZjWNh2RBdC1B7u4jffSmOSUljYFH1I2eTeY+Rdi6YUIYSU9gEoZxsv3Tia
SomfMF5jt2Mouo6MzA+IhLvvFjcrcph1Qxgi9RkfdCMMd+Ipm9YWELkyG1bDRpQy
0iyHD4gvVsAqz1Y2KdRSdc3Kt+nTqwIDAQABoxkwFzAVBgNVHREEDjAMhwQAAAAA
hwR/AAABMA0GCSqGSIb3DQEBBQUAA4IBAQAhy4J0hML3NgmDRHdL5/iTucBe22Mf
jJjg2aifD1S187dHm+Il4qZNO2plWwAhN0h704f+8wpsaALxUvBIu6nvlvcMP5PH
jGN5JLe2Km3UaPvYOQU2SgacLilu+uBcIo2JSHLV6O7ziqUj5Gior6YxDLCtEZie
Ea8aX5/YjuACtEMJ1JjRqjgkM66XAoUe0E8onOK3FgTIO3tGoTJwRp0zS50pFuP0
PsZtT04ck6mmXEXXknNoAyBCvPypfms9OHqcUIW9fiQnrGbS/Ri4QSQYj0DtFk/1
na4fY1gf3zTHxH8259b/TOOaPfTnCEsOQtjUrWNR4xhmVZ+HJy4yytUW
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDbzCCAlcCAmm6MA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n
TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv
bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMH0xCzAJ
BgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZ
MBcGA1UECgwQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRow
GAYDVQQDDBFjYS5zdHJvbmdsb29wLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBANfj86jkvvYDjHBgiqWhk9Cj+bqiMq3MqnV0CBO4iuK33Fo6XssE
H+yVdXlIBFbFe6t655MdBVOR2Sfj7WqNh96vhu6PyDHiwcQlTaiLU6nhIed1J4Wv
lvnJHFmp8Wbtx5AgLT4UYu03ftvXEl2DLi3vhSL2tRM1ebXHB/KPbRWkb25DPX0P
foOHot3f2dgNe2x6kponf7E/QDmAu3s7Nlkfh+ryDhgGU7wocXEhXbprNqRqOGNo
xbXgUI+/9XDxYT/7Gn5LF/fPjtN+aB0SKMnTsDhprVlZie83mlqJ46fOOrR+vrsQ
mi/1m/TadrARtZoIExC/cQRdVM05EK4tUa8CAwEAATANBgkqhkiG9w0BAQsFAAOC
AQEAQ7k5WhyhDTIGYCNzRnrMHWSzGqa1y4tJMW06wafJNRqTm1cthq1ibc6Hfq5a
K10K0qMcgauRTfQ1MWrVCTW/KnJ1vkhiTOH+RvxapGn84gSaRmV6KZen0+gMsgae
KEGe/3Hn+PmDVV+PTamHgPACfpTww38WHIe/7Ce9gHfG7MZ8cKHNZhDy0IAYPln+
YRwMLd7JNQffHAbWb2CE1mcea4H/12U8JZW5tHCF6y9V+7IuDzqwIrLKcW3lG17n
VUG6ODF/Ryqn3V5X+TL91YyXi6c34y34IpC7MQDV/67U7+5Bp5CfeDPWW2wVSrW+
uGZtfEvhbNm6m2i4UNmpCXxUZQ==
-----END CERTIFICATE-----

21
node_modules/node-gyp/test/fixtures/ca.crt generated vendored Normal file
View File

@ -0,0 +1,21 @@
-----BEGIN CERTIFICATE-----
MIIDbzCCAlcCAmm6MA0GCSqGSIb3DQEBCwUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n
TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv
bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMH0xCzAJ
BgNVBAYTAlVTMQswCQYDVQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZ
MBcGA1UECgwQU3Ryb25nTG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRow
GAYDVQQDDBFjYS5zdHJvbmdsb29wLmNvbTCCASIwDQYJKoZIhvcNAQEBBQADggEP
ADCCAQoCggEBANfj86jkvvYDjHBgiqWhk9Cj+bqiMq3MqnV0CBO4iuK33Fo6XssE
H+yVdXlIBFbFe6t655MdBVOR2Sfj7WqNh96vhu6PyDHiwcQlTaiLU6nhIed1J4Wv
lvnJHFmp8Wbtx5AgLT4UYu03ftvXEl2DLi3vhSL2tRM1ebXHB/KPbRWkb25DPX0P
foOHot3f2dgNe2x6kponf7E/QDmAu3s7Nlkfh+ryDhgGU7wocXEhXbprNqRqOGNo
xbXgUI+/9XDxYT/7Gn5LF/fPjtN+aB0SKMnTsDhprVlZie83mlqJ46fOOrR+vrsQ
mi/1m/TadrARtZoIExC/cQRdVM05EK4tUa8CAwEAATANBgkqhkiG9w0BAQsFAAOC
AQEAQ7k5WhyhDTIGYCNzRnrMHWSzGqa1y4tJMW06wafJNRqTm1cthq1ibc6Hfq5a
K10K0qMcgauRTfQ1MWrVCTW/KnJ1vkhiTOH+RvxapGn84gSaRmV6KZen0+gMsgae
KEGe/3Hn+PmDVV+PTamHgPACfpTww38WHIe/7Ce9gHfG7MZ8cKHNZhDy0IAYPln+
YRwMLd7JNQffHAbWb2CE1mcea4H/12U8JZW5tHCF6y9V+7IuDzqwIrLKcW3lG17n
VUG6ODF/Ryqn3V5X+TL91YyXi6c34y34IpC7MQDV/67U7+5Bp5CfeDPWW2wVSrW+
uGZtfEvhbNm6m2i4UNmpCXxUZQ==
-----END CERTIFICATE-----

19
node_modules/node-gyp/test/fixtures/server.crt generated vendored Normal file
View File

@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDJjCCAg4CAhnOMA0GCSqGSIb3DQEBBQUAMH0xCzAJBgNVBAYTAlVTMQswCQYD
VQQIDAJDQTEWMBQGA1UEBwwNU2FuIEZyYW5jaXNjbzEZMBcGA1UECgwQU3Ryb25n
TG9vcCwgSW5jLjESMBAGA1UECwwJU3Ryb25nT3BzMRowGAYDVQQDDBFjYS5zdHJv
bmdsb29wLmNvbTAeFw0xNTEyMDgyMzM1MzNaFw00MzA0MjQyMzM1MzNaMBkxFzAV
BgNVBAMMDnN0cm9uZ2xvb3AuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIB
CgKCAQEAwOYI7OZ2FX/YjRgLZoDQlbPc5UZXU/j0e1wwiJNPtPEax9Y5Uoza0Pnt
Ikzkc2SfvQ+IJrhXo385tI0W5juuqbHnE7UrjUuPjUX6NHevkxcs/flmjan5wnZM
cPsGhH71WDuUEEflvZihf2Se2x+xgZtMhc5XGmVmRuZFYKvkgUhA2/w8/QrK+jPT
n9QRJxZjWNh2RBdC1B7u4jffSmOSUljYFH1I2eTeY+Rdi6YUIYSU9gEoZxsv3Tia
SomfMF5jt2Mouo6MzA+IhLvvFjcrcph1Qxgi9RkfdCMMd+Ipm9YWELkyG1bDRpQy
0iyHD4gvVsAqz1Y2KdRSdc3Kt+nTqwIDAQABoxkwFzAVBgNVHREEDjAMhwQAAAAA
hwR/AAABMA0GCSqGSIb3DQEBBQUAA4IBAQAhy4J0hML3NgmDRHdL5/iTucBe22Mf
jJjg2aifD1S187dHm+Il4qZNO2plWwAhN0h704f+8wpsaALxUvBIu6nvlvcMP5PH
jGN5JLe2Km3UaPvYOQU2SgacLilu+uBcIo2JSHLV6O7ziqUj5Gior6YxDLCtEZie
Ea8aX5/YjuACtEMJ1JjRqjgkM66XAoUe0E8onOK3FgTIO3tGoTJwRp0zS50pFuP0
PsZtT04ck6mmXEXXknNoAyBCvPypfms9OHqcUIW9fiQnrGbS/Ri4QSQYj0DtFk/1
na4fY1gf3zTHxH8259b/TOOaPfTnCEsOQtjUrWNR4xhmVZ+HJy4yytUW
-----END CERTIFICATE-----

28
node_modules/node-gyp/test/fixtures/server.key generated vendored Normal file
View File

@ -0,0 +1,28 @@
-----BEGIN PRIVATE KEY-----
MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDA5gjs5nYVf9iN
GAtmgNCVs9zlRldT+PR7XDCIk0+08RrH1jlSjNrQ+e0iTORzZJ+9D4gmuFejfzm0
jRbmO66psecTtSuNS4+NRfo0d6+TFyz9+WaNqfnCdkxw+waEfvVYO5QQR+W9mKF/
ZJ7bH7GBm0yFzlcaZWZG5kVgq+SBSEDb/Dz9Csr6M9Of1BEnFmNY2HZEF0LUHu7i
N99KY5JSWNgUfUjZ5N5j5F2LphQhhJT2AShnGy/dOJpKiZ8wXmO3Yyi6jozMD4iE
u+8WNytymHVDGCL1GR90Iwx34imb1hYQuTIbVsNGlDLSLIcPiC9WwCrPVjYp1FJ1
zcq36dOrAgMBAAECggEACg60Xm2xsHNG/ixHw+NpfLSxCr89JGKxlJD88tIDcOK1
S8AOoxA3BHhTddteeenALmJV7fbkkuC6SICmtgBcnfppmuxyRd6vsGT6o6ut2tR1
gxRy1WYMYKg8WhOshlH8RspscODeyKDhorvDUJd5cNGBDuTwQ68PwxiUe3La6iac
EVQoKohg9EmRIhMF1i8I00zXE8p3XENrlTc491ipc+gLPIP5vtqHyQztEUkZHkWd
dXbs+n1hGCr+4FxrphGYEW80HINzmume7dGChr8nvF4ZZcuWW13DJuNim6pQno1i
hM8VdXm8XphLh0XEGI5OCfu/CetkBILZRXKltZk6AQKBgQDoBqJzRlp7regYNU4q
usfS+43tPNaJ0o4DIzcLawqpmK/B/cZStzHl14Sm62BVkKV6cnWAJPeLkENPMFoV
7Q7wLZBJxpPzqXkpeiDkKN4Wovca891Rffne5Sz6IDB5mOxMjfKIEPd5RkmB5Lkp
qQLwm3YJ2AJcLagG/Gi1DFDRAQKBgQDU1G9T43Mjke6TXG0u7gCSb+VwyDRsrvJA
u2vy6+MANRc1EEF31YLmTKOU5XxUmhtIu7TUbgPoNi0HuRFXx4Zul3BPlAosLMJv
kNQbA/9d0YQAfSgTsploN5CX65dLZ4ejIzVgDZREzpIBWTze6YZTA2DT5iOIet84
DD5DujY4qwKBgG0PuUo/9oYOD3tZiv1wwD5+uY6auykbTF9TLStzzBY9y9d+hrsY
mx6zOAoRtz1g+TdeF7b9KVJzo//T9XQ68nuYnyreaWrt7SK+4jj8sK+pOEd1+0Cz
20CXLpX/jWmKpP+y9R5aA0kA7cpdjV90rwoTuN8Vpr5XQ5TNDhaTzGUBAoGABYig
fGXlkH8y3NICZL37ddNC+/O4qTrDQbudyusnM9ItkEuj6CG9DY/gkPaGjQyUuQdo
ZD2YDGmcMh81vDqL3ERDv03yFcP0KkJxwWIRObdA32JhsGFsa7FGKS0O+f7vH+bC
dITl3gQg97gCRSl9PJtR4TCSq/HF7Acld01YK5ECgYEAwLFB5JIuxrowJe74cCMP
n5Rwuc8vWdOsg+ytvQTv0/hVCdzcaLet6YvagnWTWaU7PUwTFxZs/mLQ9CAWVutK
IRzs/GWxGFjH5xotDaJdDDzSdQye4tUqvUVxv7zzzsVycCPBYFkyRQ8Tmr5FLtUJ
Cl48TZ6J8Rx5avjdtOw3QC8=
-----END PRIVATE KEY-----

22
node_modules/node-gyp/test/fixtures/test-charmap.py generated vendored Normal file
View File

@ -0,0 +1,22 @@
import sys
import locale
reload(sys)
def main():
encoding = locale.getdefaultlocale()[1]
if not encoding:
return False
sys.setdefaultencoding(encoding)
textmap = {
'cp936': u'\u4e2d\u6587',
'cp1252': u'Lat\u012Bna',
'cp932': u'\u306b\u307b\u3093\u3054'
}
if textmap.has_key(encoding):
print textmap[encoding]
return True
if __name__ == '__main__':
print main()

138
node_modules/node-gyp/test/process-exec-sync.js generated vendored Normal file
View File

@ -0,0 +1,138 @@
'use strict'
var fs = require('graceful-fs')
var child_process = require('child_process')
if (!String.prototype.startsWith) {
String.prototype.startsWith = function(search, pos) {
return this.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search
}
}
function processExecSync(file, args, options) {
var child, error, timeout, tmpdir, command, quote
command = makeCommand(file, args)
/*
this function emulates child_process.execSync for legacy node <= 0.10.x
derived from https://github.com/gvarsanyi/sync-exec/blob/master/js/sync-exec.js
*/
options = options || {}
// init timeout
timeout = Date.now() + options.timeout
// init tmpdir
var os_temp_base = '/tmp'
var os = determine_os()
os_temp_base = '/tmp'
if (process.env.TMP) {
os_temp_base = process.env.TMP
}
if (os_temp_base[os_temp_base.length - 1] !== '/') {
os_temp_base += '/'
}
tmpdir = os_temp_base + 'processExecSync.' + Date.now() + Math.random()
fs.mkdirSync(tmpdir)
// init command
if (os === 'linux') {
command = '(' + command + ' > ' + tmpdir + '/stdout 2> ' + tmpdir +
'/stderr); echo $? > ' + tmpdir + '/status'
} else {
command = '(' + command + ' > ' + tmpdir + '/stdout 2> ' + tmpdir +
'/stderr) | echo %errorlevel% > ' + tmpdir + '/status | exit'
}
// init child
child = child_process.exec(command, options)
var maxTry = 100000 // increases the test time by 6 seconds on win-2016-node-0.10
var tryCount = 0
while (tryCount < maxTry) {
try {
var x = fs.readFileSync(tmpdir + '/status')
if (x.toString() === '0') {
break
}
} catch (ignore) {}
tryCount++
if (Date.now() > timeout) {
error = child
break
}
}
['stdout', 'stderr', 'status'].forEach(function (file) {
child[file] = fs.readFileSync(tmpdir + '/' + file, options.encoding)
setTimeout(unlinkFile, 500, tmpdir + '/' + file)
})
child.status = Number(child.status)
if (child.status !== 0) {
error = child
}
try {
fs.rmdirSync(tmpdir)
} catch (ignore) {}
if (error) {
throw error
}
return child.stdout
}
function makeCommand(file, args) {
var command, quote
command = file
if (args.length > 0) {
for(var i in args) {
command = command + ' '
if (args[i][0] === '-') {
command = command + args[i]
} else {
if (!quote) {
command = command + '\"'
quote = true
}
command = command + args[i]
if (quote) {
if (args.length === (parseInt(i) + 1)) {
command = command + '\"'
}
}
}
}
}
return command
}
function determine_os() {
var os = ''
var tmpVar = ''
if (process.env.OSTYPE) {
tmpVar = process.env.OSTYPE
} else if (process.env.OS) {
tmpVar = process.env.OS
} else {
//default is linux
tmpVar = 'linux'
}
if (tmpVar.startsWith('linux')) {
os = 'linux'
}
if (tmpVar.startsWith('win')) {
os = 'win'
}
return os
}
function unlinkFile(file) {
fs.unlinkSync(file)
}
module.exports = processExecSync

24
node_modules/node-gyp/test/simple-proxy.js generated vendored Normal file
View File

@ -0,0 +1,24 @@
var http = require('http')
, https = require('https')
, server = http.createServer(handler)
, port = +process.argv[2]
, prefix = process.argv[3]
, upstream = process.argv[4]
, calls = 0
server.listen(port)
function handler (req, res) {
if (req.url.indexOf(prefix) != 0)
throw new Error('request url [' + req.url + '] does not start with [' + prefix + ']')
var upstreamUrl = upstream + req.url.substring(prefix.length)
console.log(req.url + ' -> ' + upstreamUrl)
https.get(upstreamUrl, function (ures) {
ures.on('end', function () {
if (++calls == 2)
server.close()
})
ures.pipe(res)
})
}

113
node_modules/node-gyp/test/test-addon.js generated vendored Normal file
View File

@ -0,0 +1,113 @@
'use strict'
var test = require('tape')
var path = require('path')
var fs = require('graceful-fs')
var child_process = require('child_process')
var addonPath = path.resolve(__dirname, 'node_modules', 'hello_world')
var nodeGyp = path.resolve(__dirname, '..', 'bin', 'node-gyp.js')
var execFileSync = child_process.execFileSync || require('./process-exec-sync')
var execFile = child_process.execFile
function runHello() {
var testCode = "console.log(require('hello_world').hello())"
return execFileSync(process.execPath, ['-e', testCode], { cwd: __dirname }).toString()
}
function getEncoding() {
var code = 'import locale;print locale.getdefaultlocale()[1]'
return execFileSync('python', ['-c', code]).toString().trim()
}
function checkCharmapValid() {
var data
try {
data = execFileSync('python', ['fixtures/test-charmap.py'],
{ cwd: __dirname })
} catch (err) {
return false
}
var lines = data.toString().trim().split('\n')
return lines.pop() === 'True'
}
test('build simple addon', function (t) {
t.plan(3)
// Set the loglevel otherwise the output disappears when run via 'npm test'
var cmd = [nodeGyp, 'rebuild', '-C', addonPath, '--loglevel=verbose']
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) {
var logLines = stderr.toString().trim().split(/\r?\n/)
var lastLine = logLines[logLines.length-1]
t.strictEqual(err, null)
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok')
t.strictEqual(runHello().trim(), 'world')
})
proc.stdout.setEncoding('utf-8')
proc.stderr.setEncoding('utf-8')
})
test('build simple addon in path with non-ascii characters', function (t) {
t.plan(1)
if (!checkCharmapValid()) {
return t.skip('python console app can\'t encode non-ascii character.')
}
var testDirNames = {
'cp936': '文件夹',
'cp1252': 'Latīna',
'cp932': 'フォルダ'
}
// Select non-ascii characters by current encoding
var testDirName = testDirNames[getEncoding()]
// If encoding is UTF-8 or other then no need to test
if (!testDirName) {
return t.skip('no need to test')
}
t.plan(3)
var data, configPath = path.join(addonPath, 'build', 'config.gypi')
try {
data = fs.readFileSync(configPath, 'utf8')
} catch (err) {
t.error(err)
return
}
var config = JSON.parse(data.replace(/\#.+\n/, ''))
var nodeDir = config.variables.nodedir
var testNodeDir = path.join(addonPath, testDirName)
// Create symbol link to path with non-ascii characters
try {
fs.symlinkSync(nodeDir, testNodeDir, 'dir')
} catch (err) {
switch (err.code) {
case 'EEXIST': break
case 'EPERM':
t.error(err, 'Please try to running console as an administrator')
return
default:
t.error(err)
return
}
}
var cmd = [nodeGyp, 'rebuild', '-C', addonPath,
'--loglevel=verbose', '-nodedir=' + testNodeDir]
var proc = execFile(process.execPath, cmd, function (err, stdout, stderr) {
try {
fs.unlink(testNodeDir)
} catch (err) {
t.error(err)
}
var logLines = stderr.toString().trim().split(/\r?\n/)
var lastLine = logLines[logLines.length-1]
t.strictEqual(err, null)
t.strictEqual(lastLine, 'gyp info ok', 'should end in ok')
t.strictEqual(runHello().trim(), 'world')
})
proc.stdout.setEncoding('utf-8')
proc.stderr.setEncoding('utf-8')
})

74
node_modules/node-gyp/test/test-configure-python.js generated vendored Normal file
View File

@ -0,0 +1,74 @@
'use strict'
var test = require('tape')
var path = require('path')
var gyp = require('../lib/node-gyp')
var requireInject = require('require-inject')
var configure = requireInject('../lib/configure', {
'graceful-fs': {
'openSync': function (file, mode) { return 0; },
'closeSync': function (fd) { },
'writeFile': function (file, data, cb) { cb() },
'stat': function (file, cb) { cb(null, {}) }
}
})
var EXPECTED_PYPATH = path.join(__dirname, '..', 'gyp', 'pylib')
var SEPARATOR = process.platform == 'win32' ? ';' : ':'
var SPAWN_RESULT = { on: function () { } }
test('configure PYTHONPATH with no existing env', function (t) {
t.plan(1)
delete process.env.PYTHONPATH
var prog = gyp()
prog.parseArgv([])
prog.spawn = function () {
t.equal(process.env.PYTHONPATH, EXPECTED_PYPATH)
return SPAWN_RESULT
}
configure(prog, [], t.fail)
})
test('configure PYTHONPATH with existing env of one dir', function (t) {
t.plan(2)
var existingPath = path.join('a', 'b')
process.env.PYTHONPATH = existingPath
var prog = gyp()
prog.parseArgv([])
prog.spawn = function () {
t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
t.deepEqual(dirs, [EXPECTED_PYPATH, existingPath])
return SPAWN_RESULT
}
configure(prog, [], t.fail)
})
test('configure PYTHONPATH with existing env of multiple dirs', function (t) {
t.plan(2)
var pythonDir1 = path.join('a', 'b')
var pythonDir2 = path.join('b', 'c')
var existingPath = [pythonDir1, pythonDir2].join(SEPARATOR)
process.env.PYTHONPATH = existingPath
var prog = gyp()
prog.parseArgv([])
prog.spawn = function () {
t.equal(process.env.PYTHONPATH, [EXPECTED_PYPATH, existingPath].join(SEPARATOR))
var dirs = process.env.PYTHONPATH.split(SEPARATOR)
t.deepEqual(dirs, [EXPECTED_PYPATH, pythonDir1, pythonDir2])
return SPAWN_RESULT
}
configure(prog, [], t.fail)
})

102
node_modules/node-gyp/test/test-download.js generated vendored Normal file
View File

@ -0,0 +1,102 @@
'use strict'
var fs = require('fs')
var http = require('http')
var https = require('https')
var test = require('tape')
var install = require('../lib/install')
test('download over http', function (t) {
t.plan(2)
var server = http.createServer(function (req, res) {
t.strictEqual(req.headers['user-agent'],
'node-gyp v42 (node ' + process.version + ')')
res.end('ok')
server.close()
})
var host = '127.0.0.1'
server.listen(0, host, function () {
var port = this.address().port
var gyp = {
opts: {},
version: '42',
}
var url = 'http://' + host + ':' + port
var req = install.test.download(gyp, {}, url)
req.on('response', function (res) {
var body = ''
res.setEncoding('utf8')
res.on('data', function(data) {
body += data
})
res.on('end', function() {
t.strictEqual(body, 'ok')
})
})
})
})
test('download over https with custom ca', function (t) {
t.plan(3)
var cert = fs.readFileSync(__dirname + '/fixtures/server.crt', 'utf8')
var key = fs.readFileSync(__dirname + '/fixtures/server.key', 'utf8')
var cafile = __dirname + '/fixtures/ca.crt'
var ca = install.test.readCAFile(cafile)
t.strictEqual(ca.length, 1)
var options = { ca: ca, cert: cert, key: key }
var server = https.createServer(options, function (req, res) {
t.strictEqual(req.headers['user-agent'],
'node-gyp v42 (node ' + process.version + ')')
res.end('ok')
server.close()
})
server.on('clientError', function (err) {
throw err
})
var host = '127.0.0.1'
server.listen(8000, host, function () {
var port = this.address().port
var gyp = {
opts: { cafile: cafile },
version: '42',
}
var url = 'https://' + host + ':' + port
var req = install.test.download(gyp, {}, url)
req.on('response', function (res) {
var body = ''
res.setEncoding('utf8')
res.on('data', function(data) {
body += data
})
res.on('end', function() {
t.strictEqual(body, 'ok')
})
})
})
})
test('download with missing cafile', function (t) {
t.plan(1)
var gyp = {
opts: { cafile: 'no.such.file' },
}
try {
install.test.download(gyp, {}, 'http://bad/')
} catch (e) {
t.ok(/no.such.file/.test(e.message))
}
})
test('check certificate splitting', function (t) {
var cas = install.test.readCAFile(__dirname + '/fixtures/ca-bundle.crt')
t.plan(2)
t.strictEqual(cas.length, 2)
t.notStrictEqual(cas[0], cas[1])
})

View File

@ -0,0 +1,86 @@
'use strict'
var test = require('tape')
var path = require('path')
var requireInject = require('require-inject')
var configure = requireInject('../lib/configure', {
'graceful-fs': {
'closeSync': function (fd) { return undefined },
'openSync': function (path) {
if (readableFiles.some(function (f) { return f === path} )) {
return 0
} else {
var error = new Error('ENOENT - not found')
throw error
}
}
}
})
var dir = path.sep + 'testdir'
var readableFile = 'readable_file'
var anotherReadableFile = 'another_readable_file'
var readableFileInDir = 'somedir' + path.sep + readableFile
var readableFiles = [
path.resolve(dir, readableFile),
path.resolve(dir, anotherReadableFile),
path.resolve(dir, readableFileInDir)
]
test('find accessible - empty array', function (t) {
t.plan(1)
var candidates = []
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, undefined)
})
test('find accessible - single item array, readable', function (t) {
t.plan(1)
var candidates = [ readableFile ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, path.resolve(dir, readableFile))
})
test('find accessible - single item array, readable in subdir', function (t) {
t.plan(1)
var candidates = [ readableFileInDir ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, path.resolve(dir, readableFileInDir))
})
test('find accessible - single item array, unreadable', function (t) {
t.plan(1)
var candidates = [ 'unreadable_file' ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, undefined)
})
test('find accessible - multi item array, no matches', function (t) {
t.plan(1)
var candidates = [ 'non_existent_file', 'unreadable_file' ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, undefined)
})
test('find accessible - multi item array, single match', function (t) {
t.plan(1)
var candidates = [ 'non_existent_file', readableFile ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, path.resolve(dir, readableFile))
})
test('find accessible - multi item array, return first match', function (t) {
t.plan(1)
var candidates = [ 'non_existent_file', anotherReadableFile, readableFile ]
var found = configure.test.findAccessibleSync('test', dir, candidates)
t.strictEqual(found, path.resolve(dir, anotherReadableFile))
})

115
node_modules/node-gyp/test/test-find-node-directory.js generated vendored Normal file
View File

@ -0,0 +1,115 @@
var test = require('tape')
var path = require('path')
var findNodeDirectory = require('../lib/find-node-directory')
var platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32', 'aix']
// we should find the directory based on the directory
// the script is running in and it should match the layout
// in a build tree where npm is installed in
// .... /deps/npm
test('test find-node-directory - node install', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]}
t.equal(
findNodeDirectory('/x/deps/npm/node_modules/node-gyp/lib', processObj),
path.join('/x'))
}
})
// we should find the directory based on the directory
// the script is running in and it should match the layout
// in an installed tree where npm is installed in
// .... /lib/node_modules/npm or .../node_modules/npm
// depending on the patform
test('test find-node-directory - node build', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]}
if (platforms[next] === 'win32') {
t.equal(
findNodeDirectory('/y/node_modules/npm/node_modules/node-gyp/lib',
processObj), path.join('/y'))
} else {
t.equal(
findNodeDirectory('/y/lib/node_modules/npm/node_modules/node-gyp/lib',
processObj), path.join('/y'))
}
}
})
// we should find the directory based on the execPath
// for node and match because it was in the bin directory
test('test find-node-directory - node in bin directory', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]}
t.equal(
findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),
path.join('/x/y'))
}
})
// we should find the directory based on the execPath
// for node and match because it was in the Release directory
test('test find-node-directory - node in build release dir', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj
if (platforms[next] === 'win32') {
processObj = {execPath: '/x/y/Release/node', platform: platforms[next]}
} else {
processObj = {execPath: '/x/y/out/Release/node',
platform: platforms[next]}
}
t.equal(
findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),
path.join('/x/y'))
}
})
// we should find the directory based on the execPath
// for node and match because it was in the Debug directory
test('test find-node-directory - node in Debug release dir', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj
if (platforms[next] === 'win32') {
processObj = {execPath: '/a/b/Debug/node', platform: platforms[next]}
} else {
processObj = {execPath: '/a/b/out/Debug/node', platform: platforms[next]}
}
t.equal(
findNodeDirectory('/nothere/npm/node_modules/node-gyp/lib', processObj),
path.join('/a/b'))
}
})
// we should not find it as it will not match based on the execPath nor
// the directory from which the script is running
test('test find-node-directory - not found', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj = {execPath: '/x/y/z/y', platform:next}
t.equal(findNodeDirectory('/a/b/c/d', processObj), '')
}
})
// we should find the directory based on the directory
// the script is running in and it should match the layout
// in a build tree where npm is installed in
// .... /deps/npm
// same test as above but make sure additional directory entries
// don't cause an issue
test('test find-node-directory - node install', function (t) {
t.plan(platforms.length)
for (var next = 0; next < platforms.length; next++) {
var processObj = {execPath: '/x/y/bin/node', platform: platforms[next]}
t.equal(
findNodeDirectory('/x/y/z/a/b/c/deps/npm/node_modules/node-gyp/lib',
processObj), path.join('/x/y/z/a/b/c'))
}
})

339
node_modules/node-gyp/test/test-find-python.js generated vendored Normal file
View File

@ -0,0 +1,339 @@
'use strict'
var test = require('tape')
var path = require('path')
var configure = require('../lib/configure')
var execFile = require('child_process').execFile
var PythonFinder = configure.test.PythonFinder
test('find python', function (t) {
t.plan(4)
configure.test.findPython('python', function (err, found) {
t.strictEqual(err, null)
var proc = execFile(found, ['-V'], function (err, stdout, stderr) {
t.strictEqual(err, null)
t.strictEqual(stdout, '')
t.ok(/Python 2/.test(stderr))
})
proc.stdout.setEncoding('utf-8')
proc.stderr.setEncoding('utf-8')
})
})
function poison(object, property) {
function fail() {
throw new Error('Property ' + property + ' should not have been accessed.')
}
var descriptor = {
configurable: true,
enumerable: false,
writable: true,
getter: fail,
setter: fail,
}
Object.defineProperty(object, property, descriptor)
}
// Work around a v0.10.x CI issue where path.resolve() on UNIX systems prefixes
// Windows paths with the current working directory. v0.12 and up are free of
// this issue because they use path.win32.resolve() which does the right thing.
var resolve = path.win32 && path.win32.resolve || function() {
function rstrip(s) { return s.replace(/\\+$/, '') }
return [].slice.call(arguments).map(rstrip).join('\\')
}
function TestPythonFinder() { PythonFinder.apply(this, arguments) }
TestPythonFinder.prototype = Object.create(PythonFinder.prototype)
poison(TestPythonFinder.prototype, 'env')
poison(TestPythonFinder.prototype, 'execFile')
poison(TestPythonFinder.prototype, 'resolve')
poison(TestPythonFinder.prototype, 'stat')
poison(TestPythonFinder.prototype, 'which')
poison(TestPythonFinder.prototype, 'win')
test('find python - python', function (t) {
t.plan(5)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
f.checkPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'python')
}
})
test('find python - python too old', function (t) {
t.plan(4)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.3.4')
}
f.checkPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
}
})
test('find python - python too new', function (t) {
t.plan(4)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
}
f.checkPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
}
})
test('find python - no python', function (t) {
t.plan(2)
var f = new TestPythonFinder('python', done)
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.checkPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
}
})
test('find python - no python2', function (t) {
t.plan(6)
var f = new TestPythonFinder('python2', done)
f.which = function(program, cb) {
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
t.strictEqual(program, 'python2')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
f.checkPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'python')
}
})
test('find python - no python2, no python, unix', function (t) {
t.plan(3)
var f = new TestPythonFinder('python2', done)
poison(f, 'checkPythonLauncher')
f.win = false
f.which = function(program, cb) {
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
t.strictEqual(program, 'python2')
cb(new Error('not found'))
}
f.checkPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
}
})
test('find python - no python, use python launcher', function (t) {
t.plan(8)
var f = new TestPythonFinder('python', done)
f.env = {}
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
}
f.checkPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'Z:\\snake.exe')
}
})
test('find python - python 3, use python launcher', function (t) {
t.plan(10)
var f = new TestPythonFinder('python', done)
f.env = {}
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
}
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
}
f.checkPython()
function done(err, python) {
t.strictEqual(err, null)
t.strictEqual(python, 'Z:\\snake.exe')
}
})
test('find python - python 3, use python launcher, python 2 too old',
function (t) {
t.plan(9)
var f = new TestPythonFinder('python', done)
f.checkedPythonLauncher = false
f.env = {}
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(null, program)
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'Z:\\snake.exe')
t.ok(/import sys/.test(args[1]))
cb(null, '2.3.4')
}
t.strictEqual(program, 'py.exe')
t.notEqual(args.indexOf('-2'), -1)
t.notEqual(args.indexOf('-c'), -1)
cb(null, 'Z:\\snake.exe')
}
t.strictEqual(program, 'python')
t.ok(/import sys/.test(args[1]))
cb(null, '3.0.0')
}
f.checkPython()
function done(err, python) {
t.ok(/is not supported by gyp/.test(err))
}
})
test('find python - no python, no python launcher, good guess', function (t) {
t.plan(6)
var re = /C:[\\\/]Python27[\\\/]python[.]exe/
var f = new TestPythonFinder('python', done)
f.env = {}
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
f.execFile = function(program, args, opts, cb) {
t.ok(re.test(program))
t.ok(/import sys/.test(args[1]))
cb(null, '2.7.0')
}
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
}
f.resolve = resolve
f.stat = function(path, cb) {
t.ok(re.test(path))
cb(null, {})
}
f.checkPython()
function done(err, python) {
t.ok(re.test(python))
}
})
test('find python - no python, no python launcher, bad guess', function (t) {
t.plan(4)
var f = new TestPythonFinder('python', done)
f.env = { SystemDrive: 'Z:\\' }
f.win = true
f.which = function(program, cb) {
t.strictEqual(program, 'python')
cb(new Error('not found'))
}
f.execFile = function(program, args, opts, cb) {
t.strictEqual(program, 'py.exe')
cb(new Error('not found'))
}
f.resolve = resolve
f.stat = function(path, cb) {
t.ok(/Z:[\\\/]Python27[\\\/]python.exe/.test(path))
var err = new Error('not found')
err.code = 'ENOENT'
cb(err)
}
f.checkPython()
function done(err, python) {
t.ok(/Can't find Python executable/.test(err))
}
})

37
node_modules/node-gyp/test/test-install.js generated vendored Normal file
View File

@ -0,0 +1,37 @@
'use strict'
var test = require('tape')
var install = require('../lib/install').test.install
test('EACCES retry once', function (t) {
t.plan(3)
var fs = {}
fs.stat = function (path, cb) {
var err = new Error()
err.code = 'EACCES'
cb(err)
t.ok(true);
}
var gyp = {}
gyp.devDir = __dirname
gyp.opts = {}
gyp.opts.ensure = true
gyp.commands = {}
gyp.commands.install = function (argv, cb) {
install(fs, gyp, argv, cb)
}
gyp.commands.remove = function (argv, cb) {
cb()
}
gyp.commands.install([], function (err) {
t.ok(true)
if (/"pre" versions of node cannot be installed/.test(err.message)) {
t.ok(true)
t.ok(true)
}
})
})

25
node_modules/node-gyp/test/test-options.js generated vendored Normal file
View File

@ -0,0 +1,25 @@
'use strict';
var test = require('tape')
var gyp = require('../lib/node-gyp')
test('options in environment', function (t) {
t.plan(1)
// `npm test` dumps a ton of npm_config_* variables in the environment.
Object.keys(process.env)
.filter(function(key) { return /^npm_config_/.test(key) })
.forEach(function(key) { delete process.env[key] })
// Zero-length keys should get filtered out.
process.env.npm_config_ = '42'
// Other keys should get added.
process.env.npm_config_x = '42'
// Except loglevel.
process.env.npm_config_loglevel = 'debug'
var g = gyp();
g.parseArgv(['rebuild']) // Also sets opts.argv.
t.deepEqual(Object.keys(g.opts).sort(), ['argv', 'x'])
})

637
node_modules/node-gyp/test/test-process-release.js generated vendored Normal file
View File

@ -0,0 +1,637 @@
var test = require('tape')
var processRelease = require('../lib/process-release')
test('test process release - process.version = 0.8.20', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.8.20', null)
t.equal(release.semver.version, '0.8.20')
delete release.semver
t.deepEqual(release, {
version: '0.8.20',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.8.20/',
tarballUrl: 'https://nodejs.org/dist/v0.8.20/node-v0.8.20.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.8.20/SHASUMS256.txt',
versionDir: '0.8.20',
libUrl32: 'https://nodejs.org/dist/v0.8.20/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.8.20/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
test('test process release - process.version = 0.10.21', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.10.21', null)
t.equal(release.semver.version, '0.10.21')
delete release.semver
t.deepEqual(release, {
version: '0.10.21',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.21/',
tarballUrl: 'https://nodejs.org/dist/v0.10.21/node-v0.10.21.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.21/SHASUMS256.txt',
versionDir: '0.10.21',
libUrl32: 'https://nodejs.org/dist/v0.10.21/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.21/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
// prior to -headers.tar.gz
test('test process release - process.version = 0.12.9', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.12.9', null)
t.equal(release.semver.version, '0.12.9')
delete release.semver
t.deepEqual(release, {
version: '0.12.9',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.12.9/',
tarballUrl: 'https://nodejs.org/dist/v0.12.9/node-v0.12.9.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.12.9/SHASUMS256.txt',
versionDir: '0.12.9',
libUrl32: 'https://nodejs.org/dist/v0.12.9/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.12.9/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
// prior to -headers.tar.gz
test('test process release - process.version = 0.10.41', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.10.41', null)
t.equal(release.semver.version, '0.10.41')
delete release.semver
t.deepEqual(release, {
version: '0.10.41',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.41/',
tarballUrl: 'https://nodejs.org/dist/v0.10.41/node-v0.10.41.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.41/SHASUMS256.txt',
versionDir: '0.10.41',
libUrl32: 'https://nodejs.org/dist/v0.10.41/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.41/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
// has -headers.tar.gz
test('test process release - process.release ~ node@0.10.42', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.10.42', null)
t.equal(release.semver.version, '0.10.42')
delete release.semver
t.deepEqual(release, {
version: '0.10.42',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.42/',
tarballUrl: 'https://nodejs.org/dist/v0.10.42/node-v0.10.42-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.42/SHASUMS256.txt',
versionDir: '0.10.42',
libUrl32: 'https://nodejs.org/dist/v0.10.42/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.42/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
// has -headers.tar.gz
test('test process release - process.release ~ node@0.12.10', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v0.12.10', null)
t.equal(release.semver.version, '0.12.10')
delete release.semver
t.deepEqual(release, {
version: '0.12.10',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.12.10/',
tarballUrl: 'https://nodejs.org/dist/v0.12.10/node-v0.12.10-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.12.10/SHASUMS256.txt',
versionDir: '0.12.10',
libUrl32: 'https://nodejs.org/dist/v0.12.10/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.12.10/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
test('test process release - process.release ~ node@4.1.23', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v4.1.23/',
tarballUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'https://nodejs.org/dist/v4.1.23/win-x86/node.lib',
libUrl64: 'https://nodejs.org/dist/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.release ~ node@4.1.23 / corp build', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'https://some.custom.location/',
tarballUrl: 'https://some.custom.location/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://some.custom.location/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'https://some.custom.location/win-x86/node.lib',
libUrl64: 'https://some.custom.location/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.version = 1.8.4', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v1.8.4', null)
t.equal(release.semver.version, '1.8.4')
delete release.semver
t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.24', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.24/',
tarballUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'https://iojs.org/download/release/v3.2.24/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.11 +libUrl32', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.11', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.11')
delete release.semver
t.deepEqual(release, {
version: '3.2.11',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.11/',
tarballUrl: 'https://iojs.org/download/release/v3.2.11/iojs-v3.2.11-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.11/SHASUMS256.txt',
versionDir: 'iojs-3.2.11',
libUrl32: 'https://iojs.org/download/release/v3.2.11/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.11/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.2.101 +libUrl64', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.101')
delete release.semver
t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ iojs@3.3.0 - borked win-ia32', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v3.2.101', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
libUrl: 'https://iojs.org/download/release/v3.2.101/win-ia32/iojs.lib' // custom
})
t.equal(release.semver.version, '3.2.101')
delete release.semver
t.deepEqual(release, {
version: '3.2.101',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v3.2.101/',
tarballUrl: 'https://iojs.org/download/release/v3.2.101/iojs-v3.2.101-headers.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v3.2.101/SHASUMS256.txt',
versionDir: 'iojs-3.2.101',
libUrl32: 'https://iojs.org/download/release/v3.2.101/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v3.2.101/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --target=0.10.40', function (t) {
t.plan(2)
var release = processRelease([], { opts: { target: '0.10.40' } }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '0.10.40')
delete release.semver
t.deepEqual(release, {
version: '0.10.40',
name: 'node',
baseUrl: 'https://nodejs.org/dist/v0.10.40/',
tarballUrl: 'https://nodejs.org/dist/v0.10.40/node-v0.10.40.tar.gz',
shasumsUrl: 'https://nodejs.org/dist/v0.10.40/SHASUMS256.txt',
versionDir: '0.10.40',
libUrl32: 'https://nodejs.org/dist/v0.10.40/node.lib',
libUrl64: 'https://nodejs.org/dist/v0.10.40/x64/node.lib',
libPath32: 'node.lib',
libPath64: 'x64/node.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --target=1.8.4', function (t) {
t.plan(2)
var release = processRelease([], { opts: { target: '1.8.4' } }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '1.8.4')
delete release.semver
t.deepEqual(release, {
version: '1.8.4',
name: 'iojs',
baseUrl: 'https://iojs.org/download/release/v1.8.4/',
tarballUrl: 'https://iojs.org/download/release/v1.8.4/iojs-v1.8.4.tar.gz',
shasumsUrl: 'https://iojs.org/download/release/v1.8.4/SHASUMS256.txt',
versionDir: 'iojs-1.8.4',
libUrl32: 'https://iojs.org/download/release/v1.8.4/win-x86/iojs.lib',
libUrl64: 'https://iojs.org/download/release/v1.8.4/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
})
test('test process release - process.release ~ node@4.1.23 --dist-url=https://foo.bar/baz', function (t) {
t.plan(2)
var release = processRelease([], { opts: { 'dist-url': 'https://foo.bar/baz' } }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'https://foo.bar/baz/v4.1.23/',
tarballUrl: 'https://foo.bar/baz/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://foo.bar/baz/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'https://foo.bar/baz/v4.1.23/win-x86/node.lib',
libUrl64: 'https://foo.bar/baz/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.release ~ frankenstein@4.1.23', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'frankenstein',
headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'frankenstein',
baseUrl: 'https://frankensteinjs.org/dist/v4.1.23/',
tarballUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
shasumsUrl: 'https://frankensteinjs.org/dist/v4.1.23/SHASUMS256.txt',
versionDir: 'frankenstein-4.1.23',
libUrl32: 'https://frankensteinjs.org/dist/v4.1.23/win-x86/frankenstein.lib',
libUrl64: 'https://frankensteinjs.org/dist/v4.1.23/win-x64/frankenstein.lib',
libPath32: 'win-x86/frankenstein.lib',
libPath64: 'win-x64/frankenstein.lib'
})
})
test('test process release - process.release ~ frankenstein@4.1.23 --dist-url=http://foo.bar/baz/', function (t) {
t.plan(2)
var release = processRelease([], { opts: { 'dist-url': 'http://foo.bar/baz/' } }, 'v4.1.23', {
name: 'frankenstein',
headersUrl: 'https://frankensteinjs.org/dist/v4.1.23/frankenstein-v4.1.23.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'frankenstein',
baseUrl: 'http://foo.bar/baz/v4.1.23/',
tarballUrl: 'http://foo.bar/baz/v4.1.23/frankenstein-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/baz/v4.1.23/SHASUMS256.txt',
versionDir: 'frankenstein-4.1.23',
libUrl32: 'http://foo.bar/baz/v4.1.23/win-x86/frankenstein.lib',
libUrl64: 'http://foo.bar/baz/v4.1.23/win-x64/frankenstein.lib',
libPath32: 'win-x86/frankenstein.lib',
libPath64: 'win-x64/frankenstein.lib'
})
})
test('test process release - process.release ~ node@4.0.0-rc.4', function (t) {
t.plan(2)
var release = processRelease([], { opts: {} }, 'v4.0.0-rc.4', {
name: 'node',
headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
})
t.equal(release.semver.version, '4.0.0-rc.4')
delete release.semver
t.deepEqual(release, {
version: '4.0.0-rc.4',
name: 'node',
baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
versionDir: '4.0.0-rc.4',
libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.release ~ node@4.0.0-rc.4 passed as argv[0]', function (t) {
t.plan(2)
// note the missing 'v' on the arg, it should normalise when checking
// whether we're on the default or not
var release = processRelease([ '4.0.0-rc.4' ], { opts: {} }, 'v4.0.0-rc.4', {
name: 'node',
headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
})
t.equal(release.semver.version, '4.0.0-rc.4')
delete release.semver
t.deepEqual(release, {
version: '4.0.0-rc.4',
name: 'node',
baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
versionDir: '4.0.0-rc.4',
libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - process.release ~ node@4.0.0-rc.4 - bogus string passed as argv[0]', function (t) {
t.plan(2)
// additional arguments can be passed in on the commandline that should be ignored if they
// are not specifying a valid version @ position 0
var release = processRelease([ 'this is no version!' ], { opts: {} }, 'v4.0.0-rc.4', {
name: 'node',
headersUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz'
})
t.equal(release.semver.version, '4.0.0-rc.4')
delete release.semver
t.deepEqual(release, {
version: '4.0.0-rc.4',
name: 'node',
baseUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/',
tarballUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/node-v4.0.0-rc.4-headers.tar.gz',
shasumsUrl: 'https://nodejs.org/download/rc/v4.0.0-rc.4/SHASUMS256.txt',
versionDir: '4.0.0-rc.4',
libUrl32: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x86/node.lib',
libUrl64: 'https://nodejs.org/download/rc/v4.0.0-rc.4/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
})
test('test process release - NODEJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.NODEJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'http://foo.bar/v4.1.23/',
tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
delete process.env.NODEJS_ORG_MIRROR
})
test('test process release - NVM_NODEJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.NVM_NODEJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v4.1.23', {
name: 'node',
headersUrl: 'https://nodejs.org/dist/v4.1.23/node-v4.1.23-headers.tar.gz'
})
t.equal(release.semver.version, '4.1.23')
delete release.semver
t.deepEqual(release, {
version: '4.1.23',
name: 'node',
baseUrl: 'http://foo.bar/v4.1.23/',
tarballUrl: 'http://foo.bar/v4.1.23/node-v4.1.23-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v4.1.23/SHASUMS256.txt',
versionDir: '4.1.23',
libUrl32: 'http://foo.bar/v4.1.23/win-x86/node.lib',
libUrl64: 'http://foo.bar/v4.1.23/win-x64/node.lib',
libPath32: 'win-x86/node.lib',
libPath64: 'win-x64/node.lib'
})
delete process.env.NVM_NODEJS_ORG_MIRROR
})
test('test process release - IOJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.IOJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
delete process.env.IOJS_ORG_MIRROR
})
test('test process release - NVM_IOJS_ORG_MIRROR', function (t) {
t.plan(2)
process.env.NVM_IOJS_ORG_MIRROR = 'http://foo.bar'
var release = processRelease([], { opts: {} }, 'v3.2.24', {
name: 'io.js',
headersUrl: 'https://iojs.org/download/release/v3.2.24/iojs-v3.2.24-headers.tar.gz'
})
t.equal(release.semver.version, '3.2.24')
delete release.semver
t.deepEqual(release, {
version: '3.2.24',
name: 'iojs',
baseUrl: 'http://foo.bar/v3.2.24/',
tarballUrl: 'http://foo.bar/v3.2.24/iojs-v3.2.24-headers.tar.gz',
shasumsUrl: 'http://foo.bar/v3.2.24/SHASUMS256.txt',
versionDir: 'iojs-3.2.24',
libUrl32: 'http://foo.bar/v3.2.24/win-x86/iojs.lib',
libUrl64: 'http://foo.bar/v3.2.24/win-x64/iojs.lib',
libPath32: 'win-x86/iojs.lib',
libPath64: 'win-x64/iojs.lib'
})
delete process.env.NVM_IOJS_ORG_MIRROR
})