This commit is contained in:
@@ -10,8 +10,34 @@ import { joinBase, normalizeSiteBase } from '../scripts/lib/site-base.ts'
|
||||
import { StaticOverflowAuditor, auditStaticDecks } from '../scripts/lib/static-overflow.ts'
|
||||
import { hasPresenterToken, hashPresenterToken } from '../scripts/lib/token.ts'
|
||||
import { auditBuiltDecks } from '../scripts/lib/overflow-audit.ts'
|
||||
import { createBrowserInstallCommand } from '../scripts/lib/browser-install.ts'
|
||||
import { resolveImageSource } from '../packages/slidev-theme-easy-jyy/utils/resolve-image.ts'
|
||||
|
||||
describe('browser installation', () => {
|
||||
it('uses the Chromium-only Playwright CLI bundled with the engine', () => {
|
||||
const command = createBrowserInstallCommand([])
|
||||
|
||||
expect(command.command).toBe(process.execPath)
|
||||
expect(command.args.at(-3)).toMatch(/playwright-chromium[/\\]cli\.js$/)
|
||||
expect(command.args.slice(-2)).toEqual(['install', 'chromium'])
|
||||
})
|
||||
|
||||
it('supports Linux system dependency installation and rejects unknown options', () => {
|
||||
expect(createBrowserInstallCommand(['--with-deps']).args.slice(-3)).toEqual([
|
||||
'install',
|
||||
'--with-deps',
|
||||
'chromium',
|
||||
])
|
||||
expect(() => createBrowserInstallCommand(['--firefox'])).toThrow('不支持参数')
|
||||
expect(() => createBrowserInstallCommand(['--with-deps', '--with-deps'])).toThrow('只能指定一次')
|
||||
})
|
||||
|
||||
it('includes browser installation in generated CI workflows', async () => {
|
||||
const source = await readFile(path.join(process.cwd(), 'scripts/init.ts'), 'utf8')
|
||||
expect(source).toContain('pnpm exec easy-slides install-browser --with-deps')
|
||||
})
|
||||
})
|
||||
|
||||
function overflowingList(title: string, count: number) {
|
||||
return `# ${title}\n\n${Array.from({ length: count }, (_, index) => `- 第 ${index + 1} 条内容用于触发明显的静态高度风险`).join('\n')}\n`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user