Skip to content

test(rsc): debug flaky #536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions .github/workflows/ci-rsc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,19 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
os: [windows-latest]
browser: [chromium]
# os: [ubuntu-latest, macos-latest, windows-latest]
# browser: [chromium]
rolldown: [false]
include:
- os: ubuntu-latest
browser: firefox
- os: macos-latest
browser: webkit
- os: ubuntu-latest
browser: chromium
rolldown: true
# include:
# - os: ubuntu-latest
# browser: firefox
# - os: macos-latest
# browser: webkit
# - os: ubuntu-latest
# browser: chromium
# rolldown: true
fail-fast: false
steps:
- uses: actions/checkout@v4
Expand Down
17 changes: 13 additions & 4 deletions packages/plugin-rsc/e2e/basic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { readFileSync } from 'node:fs'
import { type Page, expect, test } from '@playwright/test'
import { type Fixture, setupIsolatedFixture, useFixture } from './fixture'
import { expectNoReload, testNoJs, waitForHydration } from './helper'
import os from 'node:os'
import path from 'node:path'

// TODO: parallel?
// TODO: all tests don't need to be tested in all variants?
Expand Down Expand Up @@ -103,11 +105,18 @@ test.describe('build-react-compiler', () => {
defineTest(f)
})

test.describe(() => {
// disabled by default
if (process.env.TEST_ISOLATED !== 'true') return
test.describe.configure({ mode: 'serial' })

let tmpRoot = '/tmp/test-vite-rsc'
test.describe.only(() => {
// disabled by default
// if (process.env.TEST_ISOLATED !== 'true') return

// use RUNNER_TEMP on Github Actions
// https://github.com/actions/toolkit/issues/518
const tmpRoot = path.join(
process.env['RUNNER_TEMP'] || os.tmpdir(),
'test-vite-rsc',
)
test.beforeAll(async () => {
await setupIsolatedFixture({ src: 'examples/basic', dest: tmpRoot })
})
Expand Down
11 changes: 7 additions & 4 deletions packages/plugin-rsc/e2e/fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,9 @@ export async function setupIsolatedFixture(options: {
}) {
// copy fixture
fs.rmSync(options.dest, { recursive: true, force: true })
fs.cpSync(options.src, options.dest, { recursive: true })
fs.rmSync(path.join(options.dest, 'node_modules'), {
fs.cpSync(options.src, options.dest, {
recursive: true,
force: true,
filter: (src) => !src.includes('node_modules'),
})

// setup package.json overrides
Expand All @@ -174,7 +173,11 @@ export async function setupIsolatedFixture(options: {
throwOnError: true,
nodeOptions: {
cwd: options.dest,
stdio: process.env.TEST_DEBUG ? 'inherit' : undefined,
stdio: [
'ignore',
process.env.TEST_DEBUG ? 'inherit' : 'ignore',
'inherit',
],
},
})
}
Expand Down
7 changes: 4 additions & 3 deletions packages/plugin-rsc/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import { defineConfig, devices } from '@playwright/test'
export default defineConfig({
testDir: 'e2e',
use: {
trace: 'on-first-retry',
// trace: 'on-first-retry',
trace: 'retain-on-failure',
},
expect: {
toPass: { timeout: 5000 },
Expand All @@ -27,8 +28,8 @@ export default defineConfig({
},
],
workers: 1,
forbidOnly: !!process.env.CI,
retries: process.env.CI ? 2 : 0,
// forbidOnly: !!process.env.CI,
// retries: process.env.CI ? 2 : 0,
reporter: ['list', process.env.CI && 'github']
.filter(Boolean)
.map((name) => [name] as any),
Expand Down
Loading