mirror of
https://github.com/danog/code-server.git
synced 2024-11-30 04:39:46 +01:00
c51ff3bce1
* feat: add installExtension integration test This adds a new helper function called `runCodeServerCommand` along with a test for `--install-extension`. We can use this approach for writing integration tests (i.e. testing a real code-server build, CLI commands, etc). * refactor: s/ test:standalone with test:integration This replaces our integration approach to use Jest instead of a single bash script. By doing this, we will be able to easily maintain and add to our integration test suite. * refactor: filter unit tests Now that our integration tests also use Jest, we need to update our unit test script to ignore `test/integration`. * refactor: add SKIP_SUBMODULE_DEPS to postinstall * refactor: add SKIP_SUBMODULE_DEPS to postinstall * fixup!: skip submod deps * refactor: move runCodeServerCommand into sep. file When Jest runs a test, it loads all the files and imports for that test. This means you might be "requiring" code that's unrelated to your tests. This leads to unexpected errors depending on where the code runs. Moved this file to avoid GLIBC and other errors relaed to argon2 when running integration tests in CI. * fizup: formatting * fizup: increase timeout * refactor: use fixture in installExtension test Instead of relying on a network to install an extension, we use a fixture - vsix file in the repo. This is also faster. * feat: add integration test for listExtensions * chore: ignore integration fixtures * fixup: formatting * fixup: remove custom-hacks.css * fixup: formatting * Update test/integration/installExtension.test.ts Co-authored-by: Asher <ash@coder.com> * Update test/integration/listExtensions.test.ts Co-authored-by: Asher <ash@coder.com> * Update test/integration/installExtension.test.ts Co-authored-by: Asher <ash@coder.com> * Update test/integration/listExtensions.test.ts Co-authored-by: Asher <ash@coder.com> * fixup: contributing integration tests section * fixup: update ci/readme * fixup: use RELEASE_PATH in test-integration.sh * refactor: unzip vsix for listExtensions * refactor: use exec instead of spawn * Update docs/CONTRIBUTING.md Co-authored-by: Asher <ash@coder.com> * Update test/integration/listExtensions.test.ts Co-authored-by: Asher <ash@coder.com> * Update test/integration/listExtensions.test.ts Co-authored-by: Asher <ash@coder.com> * Update test/integration/listExtensions.test.ts Co-authored-by: Asher <ash@coder.com> * refactor: use different default binary path * fixup!: formatting Co-authored-by: Asher <ash@coder.com>
37 lines
1.1 KiB
Bash
Executable File
37 lines
1.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
main() {
|
|
cd "$(dirname "$0")/../.."
|
|
|
|
source ./ci/lib.sh
|
|
|
|
echo "Building test plugin"
|
|
pushd test/unit/node/test-plugin
|
|
make -s out/index.js
|
|
popd
|
|
|
|
# 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
|
|
|
|
# We must keep jest in a sub-directory. See ../../test/package.json for more
|
|
# information. We must also run it from the root otherwise coverage will not
|
|
# include our source files.
|
|
CS_DISABLE_PLUGINS=true ./test/node_modules/.bin/jest "$@" --testRegex "./test/unit/.*ts" --testPathIgnorePatterns "./test/unit/node/test-plugin"
|
|
}
|
|
|
|
main "$@"
|