All checks were successful
CI/CD / detect-changes (pull_request) Successful in 23s
CI/CD / test-frontend (pull_request) Successful in 26s
CI/CD / test-go-pg (pull_request) Successful in 2m35s
CI/CD / test-sqlite (pull_request) Successful in 3m19s
CI/CD / build-and-deploy (pull_request) Successful in 1m46s
sw.testing SDK module — structured test framework for surface runners: - suite/test registration, lifecycle hooks (beforeAll/afterAll/beforeEach/afterEach) - Assertion library (ok/eq/neq/gt/match/throws/status/shape/arrayOf) - Auto-cleanup via track(type, id) with LIFO deletion - Three result statuses: passed/failed/warned - Structured JSON results with timing, warnings, cleanup stats test-runner manifest type: - ValidateManifest accepts "test-runner" packages - Excluded from sidebar nav (extensionNavItems filters surface/full only) - DB migrations: SQLite 013, Postgres 014 (CHECK constraint) ICD runner migration (kernel-only): - Migrated from T.test()/T.assert() to sw.testing.suite() - Stripped extension-dependent tests (channels, notes, personas, etc.) - Kernel suites: smoke, crud, authz, security, providers, packaging, sdk - Deleted ui.js + css (rendering delegated to registry surface) SDK runner migration (kernel-only): - Migrated from T.dualTest()/T.domains to sw.testing.suite() - Stripped extension domains (belong in v0.7.2 package runners) - Kernel suites: misc, workflows, admin, packages, connections, deps, composition Runner registry surface (/s/test-runners): - Admin-only dashboard discovering test-runner packages - Run All / per-runner Run buttons, real-time results - Export Failures / Export Full Results (JSON download) - Dark mode styling using kernel CSS variables - Suite count polling for async runner script loading 141 passed, 0 failed on fresh minimal install. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
120 lines
4.4 KiB
JavaScript
120 lines
4.4 KiB
JavaScript
/**
|
|
* ICD Test Runner — Entry Point / Module Loader
|
|
*
|
|
* Creates the shared ICD namespace and loads modules in dependency order.
|
|
* Each module is an IIFE that registers suites via sw.testing.suite().
|
|
*
|
|
* Load order:
|
|
* 1. framework.js — Assertion library, ICD shapes, API wrappers, token capture
|
|
* 2. fixtures.js — Test user/team/group provisioning
|
|
* 3. tier-smoke.js — Read-only GET tests
|
|
* 4. crud/_helpers.js — Shared CRUD utilities (ZIP builder)
|
|
* 5. crud/*.js — Per-group CRUD test modules (each registers sw.testing.suite)
|
|
* 6. tier-crud.js — (reserved, no-op — each crud module registers directly)
|
|
* 7. tier-authz.js — Permission boundary tests
|
|
* 8. tier-security.js — Adversarial red-team tests
|
|
* 9. tier-providers.js — Three-tier provider CRUD + live completions
|
|
* 10. tier-packaging.js — Extension permission lifecycle + secrets
|
|
* 11. tier-sdk.js — SDK contract tests
|
|
*/
|
|
(async function () {
|
|
'use strict';
|
|
|
|
// ─── Boot Preact SDK ─────────────────────────────────────
|
|
try {
|
|
var base = window.__BASE__ || '';
|
|
var ver = window.__VERSION__ || '0';
|
|
|
|
if (!window.preact) {
|
|
var { h, render } = await import(base + '/js/sw/vendor/preact.module.js');
|
|
var hooksModule = await import(base + '/js/sw/vendor/hooks.module.js');
|
|
var htmModule = await import(base + '/js/sw/vendor/htm.module.js');
|
|
window.preact = { h, render };
|
|
window.hooks = hooksModule;
|
|
window.html = htmModule.default.bind(h);
|
|
}
|
|
|
|
var sdk = await import(base + '/js/sw/sdk/index.js?v=' + ver);
|
|
await sdk.boot();
|
|
console.log('[ICD] SDK booted — window.sw ready');
|
|
} catch (e) {
|
|
console.warn('[ICD] SDK boot failed:', e.message);
|
|
}
|
|
|
|
// ─── Shared Namespace ───────────────────────────────────
|
|
window.ICD = {
|
|
manifest: window.__MANIFEST__ || {},
|
|
user: window.sw?.auth?.user || {},
|
|
base: window.__BASE__ || '',
|
|
|
|
// Module slots (populated by each module)
|
|
S: {}, // shapes
|
|
crud: {}, // CRUD group references (legacy — each now registers sw.testing.suite directly)
|
|
fixtures: { ready: false, users: [], team: null, group: null },
|
|
providerSetup: { provider: 'openai', apiKey: '', endpoint: '', configured: false }
|
|
};
|
|
|
|
// ─── Script Loader ──────────────────────────────────────
|
|
// Always use own package ID for asset paths — when loaded by the registry
|
|
// surface, __MANIFEST__ belongs to the registry, not this runner.
|
|
var surfaceId = 'icd-test-runner';
|
|
var assetBase = '/surfaces/' + surfaceId + '/js/';
|
|
var rbase = window.__BASE__ || '';
|
|
if (rbase) assetBase = rbase + assetBase;
|
|
|
|
var modules = [
|
|
'framework.js',
|
|
'fixtures.js',
|
|
'tier-smoke.js',
|
|
// CRUD helpers + per-group modules
|
|
'crud/_helpers.js',
|
|
'crud/profile.js',
|
|
'crud/notifications.js',
|
|
'crud/admin.js',
|
|
'crud/workflows.js',
|
|
'crud/team-workflows.js',
|
|
'crud/teams.js',
|
|
'crud/extensions.js',
|
|
'crud/surfaces.js',
|
|
'crud/editor-package.js',
|
|
'crud/dashboard-package.js',
|
|
// Remaining tiers
|
|
'tier-crud.js',
|
|
'tier-authz.js',
|
|
'tier-security.js',
|
|
'tier-providers.js',
|
|
'tier-packaging.js',
|
|
'tier-sdk.js'
|
|
];
|
|
|
|
var loaded = 0;
|
|
|
|
function loadNext() {
|
|
if (loaded >= modules.length) {
|
|
onReady();
|
|
return;
|
|
}
|
|
var script = document.createElement('script');
|
|
script.src = assetBase + modules[loaded] + '?v=' + (window.__VERSION__ || '0') + '.' + Date.now();
|
|
script.onload = function () { loaded++; loadNext(); };
|
|
script.onerror = function () {
|
|
console.error('[ICD] Failed to load: ' + modules[loaded]);
|
|
loaded++; loadNext();
|
|
};
|
|
document.body.appendChild(script);
|
|
}
|
|
|
|
function onReady() {
|
|
var suites = window.sw && window.sw.testing ? window.sw.testing.suites() : [];
|
|
console.log('[ICD] All modules loaded — ' + suites.length + ' suites registered');
|
|
// If loaded as standalone surface (not via registry), redirect to registry
|
|
var manifest = window.__MANIFEST__ || {};
|
|
if (manifest.id === 'icd-test-runner') {
|
|
var rbase = window.__BASE__ || '';
|
|
window.location.href = rbase + '/s/test-runners';
|
|
}
|
|
}
|
|
|
|
loadNext();
|
|
})();
|