browser tests run only by hand: the suites that launch Chrome / Chromium move to tests/browser/*.browser.ts (bun test, ci, ci:quick and the Forgejo workflows never pick them up; bun run test:browser runs them); the desktop boot check leaves bun run ci (it stays in desktop-release.ts mac at release time); CI=full is gone: Forgejo's ci runs the Rust steps when the push changed a Rust input (STOREBOUND_CI_BASE=HEAD~1), no Playwright install; CONTRIBUTING

This commit is contained in:
CRTkafa 2026-10-15 01:25:17 +08:00
parent 4c7ff89950
commit cd1e13c1e2
20 changed files with 116 additions and 133 deletions

View file

@ -1,5 +1,7 @@
import { describe, expect, test } from 'bun:test';
import { balance, deferBrowser, depsOf, GLOBAL, HEAVY, junitTimes, listTests, mergeTimings, relatedTests, rustNeeded, shardCount } from '../tools/ci-plan';
import { existsSync } from 'node:fs';
import { join } from 'node:path';
import { balance, deferBrowser, depsOf, GLOBAL, HEAVY, junitTimes, listTests, mergeTimings, relatedTests, ROOT, rustNeeded, shardCount } from '../tools/ci-plan';
describe('tools/ci-plan: browser suites deferred on a busy machine', () => {
test('deferred only when the 1-minute load is above 2x the cores, never with CI=full', () => {
@ -48,9 +50,10 @@ describe('tools/ci-plan: test shards', () => {
expect(t).toEqual({ 'a.test.ts': 20, 'b.test.ts': 20, 'keep.test.ts': 3, 'new.test.ts': 5 });
});
test('every heavy suite exists and every test file is found', () => {
test('the browser suites exist but are never in the CI test list (bun run test:browser only)', () => {
const all = listTests();
for (const h of HEAVY) expect(all).toContain(h);
for (const h of HEAVY) { expect(existsSync(join(ROOT, h))).toBe(true); expect(all).not.toContain(h); }
expect(all.some(f => f.startsWith('tests/browser/'))).toBe(false);
expect(all).toContain('tests/ci-plan.test.ts');
expect(all).toContain('apps/desktop/tests/webview.test.ts');
expect(all.some(f => f.includes('node_modules') || f.includes('/fixtures/'))).toBe(false);
@ -73,11 +76,8 @@ describe('tools/ci-plan: related tests (ci:quick)', () => {
expect(GLOBAL.test('bunfig.toml')).toBe(true);
expect(relatedTests([['docs/nobody', 'reads.md'].join('-')], all)).toEqual([]);
});
test('a browser suite runs for its own module and its near imports, not for every shared core module', () => {
expect(relatedTests(['cli/lib/upsert.ts'], all, undefined, HEAVY)).not.toContain('tests/console-fill.test.ts');
expect(relatedTests(['cli/lib/upsert.ts'], all)).toContain('tests/console-fill.test.ts');
expect(relatedTests(['cli/console/fill.ts'], all, undefined, HEAVY)).toContain('tests/console-fill.test.ts');
expect(relatedTests(['tests/capture-web.test.ts'], all, undefined, HEAVY)).toEqual(['tests/capture-web.test.ts']);
test('ci:quick never picks a browser suite, whatever changed', () => {
for (const f of ['cli/lib/upsert.ts', 'cli/console/fill.ts', 'package.json']) expect(relatedTests([f], all).some(t => t.startsWith('tests/browser/'))).toBe(false);
});
test('Rust steps only for the Tauri crate or the sidecar build, or with CI=full / unknown diff', () => {
expect(rustNeeded(['cli/index.ts'], {})).toBe(false);