Skip to content

Commit c1612eb

Browse files
committed
test(rsc): fix setupIsolatedFixture on windows ci
1 parent fb5e40d commit c1612eb

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

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)