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:
2026-10-20 11:17:34 +08:00
committed by trae-solo-agent
parent 8052bf5781
commit a1fff482bf
20 changed files with 251 additions and 48 deletions
+7 -4
View File
@@ -1,4 +1,5 @@
import { beforeEach, describe, expect, it, vi } from 'vitest'
import { join } from 'path'
const {
mockReadFile,
@@ -145,8 +146,10 @@ describe('model catalog cache', () => {
mockGlobalFetch.mockResolvedValue({ ok: false, status: 404, json: async () => ({}) })
vi.stubGlobal('fetch', mockGlobalFetch)
mockReadFile.mockImplementation(async (path: string) => {
if (path === '/hermes/default/.env') return 'OPENROUTER_API_KEY=default-openrouter\n'
if (path === '/hermes/team/.env') {
// 生产侧用 join(profileDir, '.env') 拼路径,Windows 上是反斜杠,
// 断言必须用 join() 才能跨平台对上。
if (path === join('/hermes/default', '.env')) return 'OPENROUTER_API_KEY=default-openrouter\n'
if (path === join('/hermes/team', '.env')) {
return [
'OPENROUTER_API_KEY=team-openrouter',
'DEEPSEEK_API_KEY=team-deepseek',
@@ -240,8 +243,8 @@ describe('model catalog cache', () => {
return []
})
mockReadFile.mockImplementation(async (path: string) => {
if (path === '/hermes/default/.env') return ''
if (path === '/hermes/default/auth.json') {
if (path === join('/hermes/default', '.env')) return ''
if (path === join('/hermes/default', 'auth.json')) {
return JSON.stringify({
providers: {
'openai-codex': { tokens: { access_token: 'codex-token' } },