From fc33080efebff4b9e26b90149baeb38c3155f912 Mon Sep 17 00:00:00 2001 From: chenjiahan Date: Sun, 8 Sep 2024 20:37:45 +0800 Subject: [PATCH] test: try to fix CI --- test/jsx-hmr/index.test.ts | 24 ++++++++++++++++++++---- test/jsx-hmr/rsbuild.config.ts | 4 ---- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/test/jsx-hmr/index.test.ts b/test/jsx-hmr/index.test.ts index 62634e6..7adbddc 100644 --- a/test/jsx-hmr/index.test.ts +++ b/test/jsx-hmr/index.test.ts @@ -3,14 +3,19 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { type Page, expect, test } from '@playwright/test'; import { createRsbuild, loadConfig } from '@rsbuild/core'; -import { pluginVueJsx } from '../../src'; +import { getRandomPort } from '../helper'; const __dirname = path.dirname(fileURLToPath(import.meta.url)); test('should render', async ({ page }) => { const rsbuild = await createRsbuild({ cwd: __dirname, - rsbuildConfig: (await loadConfig({ cwd: __dirname })).content, + rsbuildConfig: { + ...(await loadConfig({ cwd: __dirname })).content, + server: { + port: getRandomPort(), + }, + }, }); const { server, urls } = await rsbuild.startDevServer(); @@ -32,7 +37,12 @@ test('should render', async ({ page }) => { test('should update', async ({ page }) => { const rsbuild = await createRsbuild({ cwd: __dirname, - rsbuildConfig: (await loadConfig({ cwd: __dirname })).content, + rsbuildConfig: { + ...(await loadConfig({ cwd: __dirname })).content, + server: { + port: getRandomPort(), + }, + }, }); const { server, urls } = await rsbuild.startDevServer(); @@ -74,7 +84,12 @@ test.describe('vue jsx hmr', () => { page = await browser.newPage(); const rsbuild = await createRsbuild({ cwd: __dirname, - rsbuildConfig: (await loadConfig({ cwd: __dirname })).content, + rsbuildConfig: { + ...(await loadConfig({ cwd: __dirname })).content, + server: { + port: getRandomPort(), + }, + }, }); const result = await rsbuild.startDevServer(); @@ -172,6 +187,7 @@ test.describe('vue jsx hmr', () => { }); // not pass + // see https://github.com/web-infra-dev/rsbuild/pull/2018 test.skip('hmr: vue script lang=jsx', async () => { await page.locator('.script').click(); await expect(page.locator('.script')).toHaveText('script 5'); diff --git a/test/jsx-hmr/rsbuild.config.ts b/test/jsx-hmr/rsbuild.config.ts index df51be7..224dd1a 100644 --- a/test/jsx-hmr/rsbuild.config.ts +++ b/test/jsx-hmr/rsbuild.config.ts @@ -2,7 +2,6 @@ import { defineConfig } from '@rsbuild/core'; import { pluginBabel } from '@rsbuild/plugin-babel'; import { pluginVue } from '@rsbuild/plugin-vue'; import { pluginVueJsx } from '@rsbuild/plugin-vue-jsx'; -import { getRandomPort } from '../helper'; export default defineConfig({ plugins: [ @@ -12,9 +11,6 @@ export default defineConfig({ }), pluginVueJsx(), ], - server: { - port: getRandomPort(), - }, performance: { buildCache: false, },