make the test suite and openapi generator platform-independent
Windows checkouts turned LF into CRLF (core.autocrlf=true), and several tests plus the openapi generator hardcoded LF or POSIX path separators. The result was a suite that was green on Linux CI but red on Windows, and an openapi.json whose /api/hermes/* routes silently disappeared when generated on Windows. Pin the repository to LF via .gitattributes, strip shebangs before Vite's SSR transform, and key route files by their posix path. Add a manually triggered macOS verification workflow so the same checks run on a self-hosted macOS runner.
This commit is contained in:
@@ -5,6 +5,7 @@ import { join } from 'path'
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest'
|
||||
|
||||
const originalEnv = { ...process.env }
|
||||
const originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')
|
||||
|
||||
class FakeChild extends EventEmitter {
|
||||
pid: number
|
||||
@@ -39,6 +40,7 @@ afterEach(() => {
|
||||
vi.restoreAllMocks()
|
||||
vi.resetModules()
|
||||
process.env = { ...originalEnv }
|
||||
if (originalPlatform) Object.defineProperty(process, 'platform', originalPlatform)
|
||||
fakeChildren = []
|
||||
})
|
||||
|
||||
@@ -46,6 +48,11 @@ describe('profile delete managed gateway lifecycle', () => {
|
||||
it('reproduces #1633 and proves delete prep suppresses managed respawn', async () => {
|
||||
vi.useFakeTimers()
|
||||
vi.resetModules()
|
||||
// 固定 platform:停止网关的手段随平台不同(POSIX 走 child.kill('SIGTERM'),
|
||||
// Windows 走 taskkill 杀进程树)。不固定的话这个用例在 Windows 上会因为
|
||||
// taskkill 是异步的而读不到 killSignals,而且会真的拿假 pid 去杀进程。
|
||||
// Windows 分支由 gateway-respawn.test.ts 单独覆盖。
|
||||
Object.defineProperty(process, 'platform', { value: 'linux' })
|
||||
const home = await mkdtemp(join(tmpdir(), 'wui-1633-'))
|
||||
process.env.HERMES_HOME = home
|
||||
process.env.HERMES_BIN = '/usr/bin/hermes'
|
||||
|
||||
Reference in New Issue
Block a user