This repository has been archived on 2026-04-03. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
core/packages/sdk-test-runner/js/main.js
Jeffrey Smith f1c47002aa
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
v0.7.1 Surface Runner Framework
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>
2026-04-01 22:49:55 +00:00

89 lines
2.8 KiB
JavaScript

/**
* SDK Test Runner — Entry Point
*
* Boot SDK, set up SDKR namespace, load modules via script tags,
* then redirect to the test-runners registry surface.
*
* Load order:
* 1. framework.js — dual-path utilities, assertions, raw fetch
* 2. shapes.js — ICD response shapes
* 3. fixtures.js — provision/teardown helpers
* 4. domains/*.js — per-domain suites (register via sw.testing.suite())
*/
(async function () {
'use strict';
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();
} catch (e) {
console.warn('[SDKR] SDK boot failed:', e.message);
}
window.SDKR = {
manifest: window.__MANIFEST__ || {},
user: window.sw?.auth?.user || {},
base: window.__BASE__ || '',
S: {},
fixtures: { ready: false, users: [], team: null, group: null }
};
// Always use own package ID — when loaded by the registry,
// __MANIFEST__ belongs to the registry surface, not this runner.
var surfaceId = 'sdk-test-runner';
var assetBase = '/surfaces/' + surfaceId + '/js/';
if (window.SDKR.base) assetBase = window.SDKR.base + assetBase;
var modules = [
'framework.js',
'shapes.js',
'fixtures.js',
// Domain test files — each registers sw.testing.suite()
'domains/misc.js',
'domains/workflows.js',
'domains/admin.js',
'domains/packages.js',
'domains/connections.js',
'domains/dependencies.js',
'domains/composition.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('[SDKR] Failed to load: ' + modules[loaded]);
loaded++; loadNext();
};
document.body.appendChild(script);
}
function onReady() {
console.log('[SDKR] All modules loaded — ' + sw.testing.suites().length + ' suites registered');
// If loaded as standalone surface (not via registry), redirect to registry
var manifest = window.__MANIFEST__ || {};
if (manifest.id === 'sdk-test-runner') {
var base = window.__BASE__ || '';
window.location.href = base + '/s/test-runners';
}
}
loadNext();
})();