70bf21e064
Deploy (to testing) and Test Playground Preview Worker / Deploy Playground Preview Worker (testing) (push) Has been skipped
Deploy Workers Shared Staging / Deploy Workers Shared Staging (push) Failing after 0s
Prerelease / build (push) Has been skipped
Handle Changesets / Handle Changesets (push) Has been cancelled
Semgrep OSS scan / semgrep-oss (push) Has been cancelled
51 lines
1.3 KiB
TypeScript
51 lines
1.3 KiB
TypeScript
import { execSync } from "node:child_process";
|
|
|
|
if (!process.env.WRANGLER) {
|
|
console.warn(
|
|
"No `WRANGLER` process environment variable provided - running local build of Wrangler"
|
|
);
|
|
}
|
|
if (!process.env.WRANGLER_IMPORT) {
|
|
console.warn(
|
|
"No `WRANGLER_IMPORT` process environment variable provided - importing from the local build of Wrangler"
|
|
);
|
|
}
|
|
|
|
if (!process.env.CLOUDFLARE_ACCOUNT_ID) {
|
|
console.warn(
|
|
"No `CLOUDFLARE_ACCOUNT_ID` variable provided, skipping API tests"
|
|
);
|
|
}
|
|
|
|
if (!process.env.CLOUDFLARE_API_TOKEN) {
|
|
console.warn(
|
|
"No `CLOUDFLARE_API_TOKEN` variable provided, skipping API tests"
|
|
);
|
|
}
|
|
|
|
function isDockerRunning() {
|
|
try {
|
|
execSync("docker ps", { stdio: "ignore" });
|
|
return true;
|
|
} catch {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
/** Indicates whether the test is being run locally (not in CI) AND docker is currently not running on the system */
|
|
const isLocalWithoutDockerRunning =
|
|
process.env.CI !== "true" && !isDockerRunning();
|
|
|
|
if (isLocalWithoutDockerRunning) {
|
|
process.env.LOCAL_TESTS_WITHOUT_DOCKER = "true";
|
|
}
|
|
|
|
if (isLocalWithoutDockerRunning) {
|
|
console.warn(
|
|
"The tests are running locally but there is no docker instance running on the system, skipping containers tests"
|
|
);
|
|
}
|
|
|
|
// Exporting noop vitest setup function allows it to be loaded as a setup file.
|
|
export const setup = () => {};
|