mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-17 13:13:35 +08:00
Ensure terminal runtimes are started through a single in-flight start, invalidate stale async starts on destroy, and load xterm base styles before app globals while hiding helper/accessibility layers in the terminal host. Tested: cd desktop && bun run check:desktop
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { readFileSync } from 'node:fs'
|
|
import { dirname, join } from 'node:path'
|
|
import { fileURLToPath } from 'node:url'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
const desktopRoot = dirname(fileURLToPath(import.meta.url))
|
|
|
|
describe('desktop build compatibility', () => {
|
|
it('keeps production bundles loadable in the macOS 12 Safari 15 WebView', () => {
|
|
const config = readFileSync(join(desktopRoot, 'vite.config.ts'), 'utf8')
|
|
|
|
expect(config).toContain("target: ['es2021', 'safari15']")
|
|
})
|
|
|
|
it('does not rely on CSS color-mix for startup-critical shell chrome', () => {
|
|
const css = readFileSync(join(desktopRoot, 'src', 'theme', 'globals.css'), 'utf8')
|
|
|
|
expect(css).not.toContain('color-mix(')
|
|
expect(css).toContain('--color-text-secondary-a72')
|
|
expect(css).toContain('--color-outline-a92')
|
|
})
|
|
|
|
it('loads xterm base styles before app globals in the desktop entry', () => {
|
|
const main = readFileSync(join(desktopRoot, 'src', 'main.tsx'), 'utf8')
|
|
|
|
const xtermImport = main.indexOf("import '@xterm/xterm/css/xterm.css'")
|
|
const globalsImport = main.indexOf("import './theme/globals.css'")
|
|
|
|
expect(xtermImport).toBeGreaterThanOrEqual(0)
|
|
expect(globalsImport).toBeGreaterThanOrEqual(0)
|
|
expect(xtermImport).toBeLessThan(globalsImport)
|
|
})
|
|
})
|