Archived
1
0
This repository has been archived on 2024-09-09. You can view files and clone it, but cannot push or open issues or pull requests.
code-server/ci/dev/test-integration.sh
2022-09-19 12:40:05 -07:00

68 lines
2.1 KiB
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
help() {
echo >&2 " You can build the standalone release with 'yarn release:standalone'"
echo >&2 " Or you can pass in a custom path."
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' yarn test:integration"
}
# Make sure a code-server release works. You can pass in the path otherwise it
# will look for release-standalone in the current directory.
#
# This is to make sure we don't have Node version errors or any other
# compilation-related errors.
main() {
cd "$(dirname "$0")/../.."
source ./ci/lib.sh
local path="$RELEASE_PATH-standalone/bin/code-server"
if [[ ! ${CODE_SERVER_PATH-} ]]; then
echo "Set CODE_SERVER_PATH to test another build of code-server"
else
path="$CODE_SERVER_PATH"
fi
# WIP jsjoeio
if [[ ! -f "test/integration/test-plugin/out/index.js" ]]; then
echo "Building test plugin"
pushd test/integration/test-plugin
make -s out/index.js
popd
fi
# TODO@jsjoeio get this working like in test-unit.sh
# ln -s "/usr/local/Cellar/code-server/4.7.0/libexec/lib/vscode/out" ./lib/vscode/out
# source ./ci/lib.sh
# Our code imports from `out` in order to work during development but if you
# have only built for production you will have not have this directory. In
# that case symlink `out` to a production build directory.
# if [[ ! -e lib/vscode/out ]]; then
# pushd lib
# local out=(vscode-reh-web-*)
# if [[ -d "${out[0]}" ]]; then
# ln -s "../${out[0]}/out" ./vscode/out
# else
# echo "Could not find lib/vscode/out or lib/vscode-reh-web-*"
# echo "Code must be built before running unit tests"
# # exit 1
# fi
# popd
# fi
echo "Running tests with code-server binary: '$path'"
if [[ ! -f $path ]]; then
echo >&2 "No code-server build detected"
echo >&2 "Looked in $path"
help
exit 1
fi
CODE_SERVER_PATH="$path" CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration" --testPathIgnorePatterns "./test/integration/fixtures" --testPathIgnorePatterns "./test/integration/test-plugin"
}
main "$@"