Skip to content

Commit aa004d4

Browse files
authored
test(rsc): fix setupIsolatedFixture on windows ci (#559)
1 parent 6328ef2 commit aa004d4

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

.github/workflows/ci-rsc.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
- run: pnpm -C packages/plugin-rsc exec playwright install ${{ matrix.browser }}
6464
- run: pnpm -C packages/plugin-rsc test-e2e-ci --project=${{ matrix.browser }}
6565
env:
66-
TEST_ISOLATED: ${{ matrix.os != 'windows-latest' }}
66+
TEST_ISOLATED: true
6767
- uses: actions/upload-artifact@v4
6868
if: always()
6969
with:

packages/plugin-rsc/e2e/basic.test.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { readFileSync } from 'node:fs'
33
import { type Page, expect, test } from '@playwright/test'
44
import { type Fixture, setupIsolatedFixture, useFixture } from './fixture'
55
import { expectNoReload, testNoJs, waitForHydration } from './helper'
6+
import path from 'node:path'
7+
import os from 'node:os'
68

79
// TODO: parallel?
810
// TODO: all tests don't need to be tested in all variants?
@@ -107,7 +109,12 @@ test.describe(() => {
107109
// disabled by default
108110
if (process.env.TEST_ISOLATED !== 'true') return
109111

110-
let tmpRoot = '/tmp/test-vite-rsc'
112+
// use RUNNER_TEMP on Github Actions
113+
// https://github.com/actions/toolkit/issues/518
114+
const tmpRoot = path.join(
115+
process.env['RUNNER_TEMP'] || os.tmpdir(),
116+
'test-vite-rsc',
117+
)
111118
test.beforeAll(async () => {
112119
await setupIsolatedFixture({ src: 'examples/basic', dest: tmpRoot })
113120
})

packages/plugin-rsc/e2e/fixture.ts

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,9 @@ export async function setupIsolatedFixture(options: {
153153
}) {
154154
// copy fixture
155155
fs.rmSync(options.dest, { recursive: true, force: true })
156-
fs.cpSync(options.src, options.dest, { recursive: true })
157-
fs.rmSync(path.join(options.dest, 'node_modules'), {
156+
fs.cpSync(options.src, options.dest, {
158157
recursive: true,
159-
force: true,
158+
filter: (src) => !src.includes('node_modules'),
160159
})
161160

162161
// setup package.json overrides
@@ -174,7 +173,11 @@ export async function setupIsolatedFixture(options: {
174173
throwOnError: true,
175174
nodeOptions: {
176175
cwd: options.dest,
177-
stdio: process.env.TEST_DEBUG ? 'inherit' : undefined,
176+
stdio: [
177+
'ignore',
178+
process.env.TEST_DEBUG ? 'inherit' : 'ignore',
179+
'inherit',
180+
],
178181
},
179182
})
180183
}

0 commit comments

Comments
 (0)