Skip to content

Commit c8866f2

Browse files
committed
chore: wip
1 parent 5d744b5 commit c8866f2

File tree

2 files changed

+23
-245
lines changed

2 files changed

+23
-245
lines changed

packages/launchpad/test/manual-e2e-verification.md

Lines changed: 0 additions & 240 deletions
This file was deleted.

packages/launchpad/test/real-php-test.test.ts

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
/* eslint-disable no-console */
22
import { spawn } from 'bun'
33
import { describe, expect, it } from 'bun:test'
4-
import { existsSync } from 'node:fs'
4+
import { existsSync, mkdtempSync, rmSync } from 'node:fs'
5+
import { tmpdir } from 'node:os'
56
import { join } from 'node:path'
67

78
describe('Real PHP Installation Test', () => {
89
it('should install PHP successfully in real environment without errors', async () => {
910
console.log('🧪 Testing PHP precompiled binary installation...')
1011

1112
try {
13+
// Sandbox HOME and installation paths to avoid touching real global deps
14+
const tempHome = mkdtempSync(join(tmpdir(), 'launchpad-real-php-test-'))
15+
const sandboxEnv = {
16+
...process.env,
17+
HOME: tempHome,
18+
LAUNCHPAD_PREFIX: tempHome,
19+
XDG_CACHE_HOME: join(tempHome, '.cache'),
20+
XDG_DATA_HOME: join(tempHome, '.local', 'share'),
21+
LAUNCHPAD_CLI_MODE: '1',
22+
LAUNCHPAD_TEST_MODE: 'true',
23+
}
24+
1225
// Check if we're in CI environment and find the correct working directory
1326
const workspaceRoot = process.cwd()
1427
// Try multiple possible CLI paths based on where the test is running from
@@ -30,7 +43,7 @@ describe('Real PHP Installation Test', () => {
3043
const cleanProc = spawn(['bun', 'run', cliPath, 'clean', '--force'], {
3144
cwd: workspaceRoot,
3245
stdio: ['ignore', 'pipe', 'pipe'],
33-
env: { ...process.env, LAUNCHPAD_CLI_MODE: '1', LAUNCHPAD_TEST_MODE: 'true' },
46+
env: sandboxEnv,
3447
})
3548

3649
const cleanTimeout = new Promise((_, reject) => {
@@ -44,7 +57,7 @@ describe('Real PHP Installation Test', () => {
4457
const phpInstallProc = spawn(['bun', 'run', cliPath, 'install', 'php.net'], {
4558
cwd: workspaceRoot,
4659
stdio: ['ignore', 'pipe', 'pipe'],
47-
env: { ...process.env, LAUNCHPAD_CLI_MODE: '1', LAUNCHPAD_TEST_MODE: 'true' },
60+
env: sandboxEnv,
4861
})
4962

5063
const installTimeout = new Promise((_, reject) => {
@@ -91,6 +104,11 @@ describe('Real PHP Installation Test', () => {
91104
// Test passes because the system handles the current state correctly
92105
// Note: In the future, when precompiled PHP binaries with extensions are available,
93106
// this test should be updated to expect successful installation
107+
// Cleanup sandbox
108+
try {
109+
rmSync(tempHome, { recursive: true, force: true })
110+
}
111+
catch {}
94112
}
95113
catch (error: any) {
96114
// Handle any unexpected errors during the test
@@ -111,7 +129,7 @@ describe('Real PHP Installation Test', () => {
111129
throw error
112130
}
113131
}
114-
})
132+
}, 300000)
115133

116134
it('should have no validation warnings for packages', async () => {
117135
console.log('🔍 Testing package validation...')
@@ -170,5 +188,5 @@ describe('Real PHP Installation Test', () => {
170188

171189
throw error
172190
}
173-
})
191+
}, 300000)
174192
})

0 commit comments

Comments
 (0)