test: add comprehensive v1.1 security, proxy/SFTP, automation/CLI & bundle tests
This commit is contained in:
parent
f45d128c4f
commit
a5a937850e
4 changed files with 1228 additions and 3 deletions
|
|
@ -26,9 +26,29 @@ describe('Phase 5: 8 Theme Presets, Code-Splitting Budgets & Galaxy J7 Mobile Op
|
|||
}
|
||||
});
|
||||
|
||||
it('meets <50KB core gzipped bundle, splits lazy chunks, preserves PWA & mobile CSS, and caps DOM streams', () => {
|
||||
it('meets <50KB core gzipped bundle (including static sync chunks), splits lazy chunks, preserves PWA & mobile CSS, and caps DOM streams', () => {
|
||||
const publicDir = path.resolve('dist/public');
|
||||
const coreFiles = ['index.html', 'themes.css', 'base.css', 'main.js'];
|
||||
|
||||
// Recursively follow static ESM imports from main.js to measure true eager core bundle
|
||||
const visitedJs = new Set<string>(['main.js']);
|
||||
const queue = ['main.js'];
|
||||
while (queue.length > 0) {
|
||||
const rel = queue.shift()!;
|
||||
const abs = path.join(publicDir, rel);
|
||||
if (!fs.existsSync(abs)) continue;
|
||||
const code = fs.readFileSync(abs, 'utf8');
|
||||
const importRe = /\bfrom\s*["']\.\/(chunks\/[^"']+\.js)["']|\bimport\s*["']\.\/(chunks\/[^"']+\.js)["']/g;
|
||||
let m: RegExpExecArray | null;
|
||||
while ((m = importRe.exec(code)) !== null) {
|
||||
const target = m[1] ?? m[2]!;
|
||||
if (!visitedJs.has(target)) {
|
||||
visitedJs.add(target);
|
||||
queue.push(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const coreFiles = ['index.html', 'themes.css', 'base.css', ...visitedJs];
|
||||
let totalCoreGzip = 0;
|
||||
|
||||
for (const f of coreFiles) {
|
||||
|
|
@ -37,13 +57,18 @@ describe('Phase 5: 8 Theme Presets, Code-Splitting Budgets & Galaxy J7 Mobile Op
|
|||
}
|
||||
expect(totalCoreGzip).toBeLessThan(50 * 1024);
|
||||
|
||||
// Heavy/optional UI stays code-split out of main.js
|
||||
// Heavy/optional views & overlays stay code-split out of main.js
|
||||
const mainJs = fs.readFileSync(path.join(publicDir, 'main.js'), 'utf8');
|
||||
expect(mainJs).not.toContain('ai-drawer-dialog');
|
||||
expect(mainJs).not.toContain('xterm-helper-textarea');
|
||||
expect(mainJs).not.toContain('Fleet Monitor');
|
||||
|
||||
const chunks = fs.readdirSync(path.join(publicDir, 'chunks'));
|
||||
expect(chunks.some((c) => c.startsWith('ai-drawer-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('command-palette-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('dashboard-view-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('settings-view-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('settings-ops-panel-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('terminal-view-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('workflows-view-') && c.endsWith('.js'))).toBe(true);
|
||||
expect(chunks.some((c) => c.startsWith('alerts-view-') && c.endsWith('.js'))).toBe(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue