cline/scripts/test-ci.js
Tomás Barreiro 1700c0e4f8
Run tests against Windows and Ubuntu (#3246)
* add a matrix strategy for testing

* Handle EOL on Windows

* use bash as shell on every os and run the test-ci script

* fix tsconfig path resolution using the __dirnname

* print test results regardless of status

* Limit artifact upload to Linux

* update the test-cli

* Add windows-specific dependencies as optional dependencies

lightningcss-win32-x64-msvc
rollup-win32-x64-msvc

* Do not collect coverage on Windows

* Use UTF-8 on the Python Scripts

* force the ubuntu-latest name to be `test`
2025-05-19 13:32:35 -07:00

31 lines
930 B
JavaScript

#!/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:coverage", { stdio: "inherit" })
} else {
console.log("Non-Linux environment detected. Running tests normally.")
execSync("npm run test:integration", { 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)
}