From 9ee2556dd1ca199d46c6250d4eeacdbe6548daa6 Mon Sep 17 00:00:00 2001 From: Joe Previte Date: Tue, 9 Mar 2021 16:36:56 -0700 Subject: [PATCH] chore: update gitignore with test dirs --- .github/workflows/ci.yaml | 11 ++++++----- .gitignore | 4 ++-- ci/steps/test-e2e.sh | 2 +- test/utils/integration.ts | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 8 deletions(-) create mode 100644 test/utils/integration.ts diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 8bef3db6..914ad567 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -35,7 +35,6 @@ jobs: uses: ./ci/images/debian10 with: args: ./ci/steps/test-unit.sh - test-e2e: needs: linux-amd64 runs-on: ubuntu-latest @@ -53,15 +52,17 @@ jobs: run: | cd release-packages && tar -xzf code-server*-linux-amd64.tar.gz - uses: microsoft/playwright-github-action@v1 - - name: Install dependencies and run tests - with: - args: ./ci/steps/test-e2e.sh + - name: Install dependencies and run end-to-end tests + run: | + ./release-packages/code-server*-linux-amd64/bin/code-server --home $CODE_SERVER_ADDRESS/healthz & + yarn --frozen-lockfile + yarn test:e2e - name: Upload test artifacts if: always() uses: actions/upload-artifact@v2 with: name: test-videos - path: ./test/e2e//videos + path: ./test/e2e/videos - name: Remove release packages and test artifacts run: rm -rf ./release-packages ./test/e2e/videos diff --git a/.gitignore b/.gitignore index e49888f4..45da9b42 100644 --- a/.gitignore +++ b/.gitignore @@ -16,5 +16,5 @@ node-* .home coverage **/.DS_Store -test/videos -test/screenshots +test/e2e/videos +test/e2e/screenshots diff --git a/ci/steps/test-e2e.sh b/ci/steps/test-e2e.sh index c1aa148a..c43fbd07 100755 --- a/ci/steps/test-e2e.sh +++ b/ci/steps/test-e2e.sh @@ -4,7 +4,7 @@ set -euo pipefail main() { cd "$(dirname "$0")/../.." - ./release-packages/code-server*-linux-amd64/bin/code-server --home $CODE_SERVER_ADDRESS/healthz & + "./release-packages/code-server*-linux-amd64/bin/code-server" --home "$CODE_SERVER_ADDRESS"/healthz & yarn --frozen-lockfile yarn test:e2e } diff --git a/test/utils/integration.ts b/test/utils/integration.ts new file mode 100644 index 00000000..c5101d0f --- /dev/null +++ b/test/utils/integration.ts @@ -0,0 +1,21 @@ +import * as express from "express" +import { createApp } from "../../src/node/app" +import { parse, setDefaults, parseConfigFile, DefaultedArgs } from "../../src/node/cli" +import { register } from "../../src/node/routes" +import * as httpserver from "./httpserver" + +export async function setup( + argv: string[], + configFile?: string, +): Promise<[express.Application, express.Application, httpserver.HttpServer, DefaultedArgs]> { + argv = ["--bind-addr=localhost:0", ...argv] + + const cliArgs = parse(argv) + const configArgs = parseConfigFile(configFile || "", "test/integration.ts") + const args = await setDefaults(cliArgs, configArgs) + + const [app, wsApp, server] = await createApp(args) + await register(app, wsApp, server, args) + + return [app, wsApp, new httpserver.HttpServer(server), args] +}