mirror of
https://github.com/coder/code-server.git
synced 2024-11-26 12:34:02 +03:00
11b2ef9846
* refactor: add env arg to runCodeServerCommand This allows yous to pass environment variables to code-server's helper when running integration tests. * feat: add EXTENSIONS_GALLERY integration test This test ensures EXTENSIONS_GALLERY is read when set and using the `--install-extension` flag. Co-authored-by: repo-ranger[bot] <39074581+repo-ranger[bot]@users.noreply.github.com>
20 lines
605 B
TypeScript
20 lines
605 B
TypeScript
import { exec } from "child_process"
|
|
import path from "path"
|
|
import { promisify } from "util"
|
|
|
|
/**
|
|
*
|
|
* A helper function for integration tests to run code-server commands.
|
|
*/
|
|
export async function runCodeServerCommand(
|
|
argv: string[],
|
|
env?: NodeJS.ProcessEnv,
|
|
): Promise<{ stdout: string; stderr: string }> {
|
|
const CODE_SERVER_COMMAND = process.env.CODE_SERVER_PATH || path.resolve("../../release-standalone/bin/code-server")
|
|
const { stdout, stderr } = await promisify(exec)(`${CODE_SERVER_COMMAND} ${argv.join(" ")}`, {
|
|
env: { ...process.env, ...env },
|
|
})
|
|
|
|
return { stdout, stderr }
|
|
}
|