From 616d56468f5097cb6ebb14a223bbe2e11730c406 Mon Sep 17 00:00:00 2001 From: watany <76135106+watany-dev@users.noreply.github.com> Date: Tue, 25 Mar 2025 13:57:46 +0900 Subject: [PATCH] chore: Allow CI testing locally (#1708) * doc: Adding install for WebIDE Settings * adding * test:dev * Revert "test:dev" This reverts commit 91eb6a6510b23b7948d5a7be5d17e8420000c4fc. * update * updated * changeset * update ci script * update --- .changeset/metal-cheetahs-care.md | 5 +++++ CONTRIBUTING.md | 30 ++++++++++++++++++++++++++++++ package.json | 1 + scripts/test-ci.js | 30 ++++++++++++++++++++++++++++++ 4 files changed, 66 insertions(+) create mode 100644 .changeset/metal-cheetahs-care.md create mode 100644 scripts/test-ci.js diff --git a/.changeset/metal-cheetahs-care.md b/.changeset/metal-cheetahs-care.md new file mode 100644 index 0000000000..3a245c7d65 --- /dev/null +++ b/.changeset/metal-cheetahs-care.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Can test on WebIDE diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index ce24b906bf..4be4bb4eb0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,6 +31,36 @@ If you're planning to work on a bigger feature, please create a [feature request - Run `npm run test` to run tests locally - Before submitting PR, run `npm run format:fix` to format your code +3. **Linux-specific Setup** + VS Code extension tests on Linux require the following system libraries: + + - `libatk1.0-0` + - `libatk-bridge2.0-0` + - `libxkbfile1` + - `libx11-xcb1` + - `libxcomposite1` + - `libxdamage1` + - `libxfixes3` + - `libxrandr2` + - `libgbm1` + - `libdrm2` + - `libgtk-3-0` + - `dbus` + - `xvfb` + + These libraries provide necessary GUI components and system services for the test environment. + + For example, on Debian-based distributions (e.g., Ubuntu), you can install these libraries using apt: + ```bash + sudo apt update + sudo apt install -y \ + libatk1.0-0 libatk-bridge2.0-0 libxkbfile1 libx11-xcb1 \ + libxcomposite1 libxdamage1 libxfixes3 libxrandr2 libgbm1 \ + libdrm2 libgtk-3-0 dbus xvfb + ``` + + - Run `npm run test:ci` to run tests locally + ## Writing and Submitting Code Anyone can contribute code to Cline, but we ask that you follow these guidelines to ensure your contributions can be smoothly integrated: diff --git a/package.json b/package.json index b83e449e8f..fd253c3bf0 100644 --- a/package.json +++ b/package.json @@ -280,6 +280,7 @@ "format": "prettier . --check", "format:fix": "prettier . --write", "test": "vscode-test", + "test:ci": "node scripts/test-ci.js", "install:all": "npm install && cd webview-ui && npm install", "dev:webview": "cd webview-ui && npm run dev", "build:webview": "cd webview-ui && npm run build", diff --git a/scripts/test-ci.js b/scripts/test-ci.js new file mode 100644 index 0000000000..400a4cb5f6 --- /dev/null +++ b/scripts/test-ci.js @@ -0,0 +1,30 @@ +#!/usr/bin/env node +const { execSync } = require("child_process") +const process = require("process") + +try { + if (process.platform === "linux") { + console.log("Detected Linux environment.") + + execSync("which xvfb-run", { stdio: "ignore" }) + + console.log("xvfb-run is installed. Running tests with xvfb-run...") + execSync("xvfb-run -a npm run test", { stdio: "inherit" }) + } else { + console.log("Non-Linux environment detected. Running tests normally.") + execSync("npm run test", { stdio: "inherit" }) + } +} catch (error) { + if (process.platform === "linux") { + console.error( + `Error: xvfb-run is not installed.\n` + + `Please install it using the following command:\n` + + ` Debian/Ubuntu: sudo apt install xvfb\n` + + ` RHEL/CentOS: sudo yum install xvfb\n` + + ` Arch Linux: sudo pacman -S xvfb`, + ) + } else { + console.error("Error running tests:", error.message) + } + process.exit(1) +}