Skip to content

Commit eae094c

Browse files
committed
refactor: add test:native
This adds a new script to run native tests (i.e. --help which should run in ci on all platforms).
1 parent af37f1f commit eae094c

File tree

3 files changed

+42
-2
lines changed

3 files changed

+42
-2
lines changed

.github/workflows/build.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -581,8 +581,8 @@ jobs:
581581
if: steps.cache-node-modules.outputs.cache-hit != 'true'
582582
run: SKIP_SUBMODULE_DEPS=1 yarn install
583583

584-
- name: Run integration tests on standalone release
585-
run: yarn test:integration
584+
- name: Run native module tests on standalone release
585+
run: yarn test:native
586586

587587
- name: Build packages with nfpm
588588
run: yarn package

ci/dev/test-native.sh

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
help() {
5+
echo >&2 " You can build the standalone release with 'yarn release:standalone'"
6+
echo >&2 " Or you can pass in a custom path."
7+
echo >&2 " CODE_SERVER_PATH='/var/tmp/coder/code-server/bin/code-server' yarn test:integration"
8+
}
9+
10+
# Make sure a code-server release works. You can pass in the path otherwise it
11+
# will look for release-standalone in the current directory.
12+
#
13+
# This is to make sure we don't have Node version errors or any other
14+
# compilation-related errors.
15+
main() {
16+
cd "$(dirname "$0")/../.."
17+
18+
source ./ci/lib.sh
19+
20+
local path="$RELEASE_PATH-standalone/bin/code-server"
21+
if [[ ! ${CODE_SERVER_PATH-} ]]; then
22+
echo "Set CODE_SERVER_PATH to test another build of code-server"
23+
else
24+
path="$CODE_SERVER_PATH"
25+
fi
26+
27+
echo "Running tests with code-server binary: '$path'"
28+
29+
if [[ ! -f $path ]]; then
30+
echo >&2 "No code-server build detected"
31+
echo >&2 "Looked in $path"
32+
help
33+
exit 1
34+
fi
35+
36+
CODE_SERVER_PATH="$path" ./test/node_modules/.bin/jest "$@" --coverage=false --testRegex "./test/integration/help.test.ts"
37+
}
38+
39+
main "$@"

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"test:e2e:proxy": "USE_PROXY=1 ./ci/dev/test-e2e.sh",
2020
"test:unit": "./ci/dev/test-unit.sh --forceExit --detectOpenHandles",
2121
"test:integration": "./ci/dev/test-integration.sh",
22+
"test:native": "./ci/dev/test-native.sh",
2223
"test:scripts": "./ci/dev/test-scripts.sh",
2324
"package": "./ci/build/build-packages.sh",
2425
"postinstall": "./ci/dev/postinstall.sh",

0 commit comments

Comments
 (0)