2019-05-04 09:45:53 +02:00
|
|
|
#!/usr/bin/env bats
|
|
|
|
|
|
|
|
load shared-functions
|
2020-12-21 10:50:54 +01:00
|
|
|
load '../../node_modules/bats-support/load'
|
|
|
|
load '../../node_modules/bats-assert/load'
|
2019-05-04 09:45:53 +02:00
|
|
|
|
|
|
|
|
|
|
|
function setup() {
|
|
|
|
unset_n_env
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Test that files get installed to expected locations
|
|
|
|
# https://github.com/tj/n/issues/246
|
|
|
|
|
|
|
|
@test "install: contents" {
|
|
|
|
readonly TARGET_VERSION="4.9.1"
|
|
|
|
setup_tmp_prefix
|
|
|
|
|
|
|
|
[ ! -d "${N_PREFIX}/n/versions" ]
|
|
|
|
[ ! -d "${N_PREFIX}/bin" ]
|
|
|
|
[ ! -d "${N_PREFIX}/include" ]
|
|
|
|
[ ! -d "${N_PREFIX}/lib" ]
|
|
|
|
[ ! -d "${N_PREFIX}/shared" ]
|
|
|
|
|
|
|
|
n ${TARGET_VERSION}
|
|
|
|
|
|
|
|
# Cached version
|
|
|
|
[ -d "${N_PREFIX}/n/versions/node/${TARGET_VERSION}" ]
|
|
|
|
# node and npm
|
|
|
|
[ -f "${N_PREFIX}/bin/node" ]
|
|
|
|
[ -f "${N_PREFIX}/bin/npm" ]
|
|
|
|
# Installed something into each of other key folders
|
|
|
|
[ -d "${N_PREFIX}/include/node" ]
|
|
|
|
[ -d "${N_PREFIX}/lib/node_modules" ]
|
|
|
|
[ -d "${N_PREFIX}/share/doc/node" ]
|
|
|
|
# Did not install files from top level of tarball
|
|
|
|
[ ! -f "${N_PREFIX}/README.md" ]
|
|
|
|
|
2020-12-20 07:10:34 +01:00
|
|
|
output="$(node --version)"
|
2020-12-21 10:50:54 +01:00
|
|
|
assert_equal "${output}" "v${TARGET_VERSION}"
|
2019-05-04 09:45:53 +02:00
|
|
|
|
|
|
|
rm -rf "${TMP_PREFIX_DIR}"
|
|
|
|
}
|