Skip to content

Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.

chore: disable esbuild hot reload in CI (#5073)

Wenzhao Hu6e2eeda398a4
diff --git a/e2e/visual-comparison/const.ts b/e2e/visual-comparison/const.ts
index 11d6ebcbfb..4f1ac22e33 100644
--- a/e2e/visual-comparison/const.ts
+++ b/e2e/visual-comparison/const.ts
@@ -15,8 +15,8 @@
*/
// eslint-disable-next-line node/prefer-global/process
-export const isCI = !!process.env.CI;
+export const IS_CI = !!process.env.CI;
export function generateSnapshotName(name: string): string {
- return isCI ? `${name}.ci.png` : `${name}.png`;
+ return IS_CI ? `${name}.ci.png` : `${name}.png`;
}
diff --git a/examples/scripts/generate-html.ts b/examples/scripts/generate-html.ts
index 07a92eca4b..6cfa0ce0ff 100644
--- a/examples/scripts/generate-html.ts
+++ b/examples/scripts/generate-html.ts
@@ -20,6 +20,19 @@ import fs from 'fs-extra';
const __dirname = path.dirname(fileURLToPath(import.meta.url));
+// eslint-disable-next-line node/prefer-global/process
+export const IS_CI = !!process.env.CI;
+
+const ESBUILD_SCRIPT = IS_CI
+ ? '' :
+ `
+ <script>
+ new EventSource('/esbuild').addEventListener('change', () => {
+ console.info('reload--');
+ location.reload();
+ });
+ </script>`;
+
const indexTemplate = `<!doctype html>
<html lang="en">
<head>
@@ -35,14 +48,7 @@ const indexTemplate = `<!doctype html>
height: 100%;
margin: 0;
}
- </style>
-
- <script>
- new EventSource('/esbuild').addEventListener('change', () => {
- console.info('reload--');
- location.reload();
- });
- </script>
+ </style>${ESBUILD_SCRIPT}
</head>
<body style="overflow: hidden">
diff --git a/playwright.config.ts b/playwright.config.ts
index 094abe67db..c7268cfe60 100644
--- a/playwright.config.ts
+++ b/playwright.config.ts
@@ -4,7 +4,7 @@ import { defineConfig, devices } from '@playwright/test';
/**
* If you are running tests in CI, you can use the `CI` environment variable to adjust the configuration.
*/
-const isCI = !!process.env.CI;
+const IS_CI = !!process.env.CI;
const HEADLESS = !!process.env.HEADLESS;
/**
@@ -22,12 +22,12 @@ export default defineConfig({
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
- forbidOnly: !!process.env.CI,
+ forbidOnly: IS_CI,
timeout: 30_000,
/* No retry */
retries: 0,
/* Opt out of parallel tests on CI. */
- workers: process.env.CI ? 1 : undefined,
+ workers: IS_CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: [
['json', { outputFile: 'playwright-report.json' }],
@@ -46,7 +46,7 @@ export default defineConfig({
projects: [
{
name: 'chromium',
- use: { ...devices['Desktop Chrome'], headless: isCI || HEADLESS },
+ use: { ...devices['Desktop Chrome'], headless: IS_CI || HEADLESS },
},
// {
@@ -83,7 +83,7 @@ export default defineConfig({
webServer: {
command: 'pnpm serve:e2e',
url: 'http://localhost:3000',
- reuseExistingServer: !isCI,
+ reuseExistingServer: !IS_CI,
timeout: 10_000,
stdout: 'ignore',
stderr: 'pipe',