Fold MediaEngine (media-backend, media-webui) into this repo
Per owner decision: MediaEngine (the Media product family's Go backend and SvelteKit frontend, previously its own repo referenced by 7 thin service repos via git submodule) is folded directly into shared/ as media-backend/ and media-webui/, rather than staying separate. media-backend/go.mod's replace directive now points at ../backend (a true sibling within this repo) instead of a vendored ../shared/backend copy, since there's no more nested vendoring - it's the real thing. Also moved MediaEngine's own CI (media-backend-lint.yml, media-backend-tests.yml) and dev tooling scripts (scripts/media/*, audit/lint/enforce scripts for the media-backend+media-webui content), fixing their path assumptions for the new layout, and dropped scripts/media/sync-shared.mjs (confirmed dead code, and now doubly obsolete since there's no more vendored shared/ subfolder for it to check). Added media:* script aliases to package.json for the moved tooling, namespaced to avoid colliding with this repo's own scripts. Also fixed sync-consumers.ps1's workspace-root resolution to walk up until it finds a directory containing both Original/ and Forks/, instead of assuming shared/ is always a direct child of the workspace root - it broke when shared/ moved from Web/shared to Web/Central/shared earlier in this same restructuring. Removed the now-obsolete Original/MediaEngine entry from its consumer list. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
79d9461769
commit
acde180086
99 files changed
+20488
-1
No files matched your search
@@ -0,0 +1,104 @@
|
||||
#!/usr/bin/env node
|
||||
import { spawn } from 'node:child_process';
|
||||
import { createRequire } from 'node:module';
|
||||
import path from 'node:path';
|
||||
|
||||
// Run vitest with JSON reporter and parse skipped tests/suites.
|
||||
// Usage: node scripts/list-skipped-tests.mjs
|
||||
// Exits with code 0 if none skipped, 1 if any skipped.
|
||||
//
|
||||
// TODO(MediaEngine extraction): as of the extraction from MediaCollection, MediaEngine has no
|
||||
// vitest suite anywhere (webui/ has no vitest devDependency/config; shared/packages/node-backend
|
||||
// uses plain `node --test`; backend/ is Go), so `require.resolve('vitest/package.json')` below
|
||||
// will fail immediately. The hardcoded `--config ../vitest.config.mjs` below also assumed this
|
||||
// script runs from a subdirectory (e.g. the old repo-root tests/ dir) one level below a
|
||||
// vitest.config.mjs — that layout does not exist in MediaEngine either. Left unfixed rather than
|
||||
// guessed at: revisit once/if a real vitest suite is introduced in this repo, and point the
|
||||
// --config flag at wherever that config actually lives.
|
||||
|
||||
// Resolve local vitest binary (avoid relying on npx which can be absent in some CI / shells)
|
||||
function resolveVitestBin() {
|
||||
try {
|
||||
const require = createRequire(import.meta.url);
|
||||
const pkgPath = require.resolve('vitest/package.json');
|
||||
const binDir = path.dirname(pkgPath);
|
||||
// Vitest exposes a bin field pointing to dist/cli.js; require it to ensure path stability
|
||||
const pkg = require('vitest/package.json');
|
||||
if (pkg && pkg.bin && pkg.bin.vitest) {
|
||||
return path.join(binDir, pkg.bin.vitest);
|
||||
}
|
||||
// Fallback: common location
|
||||
return path.join(binDir, 'dist', 'cli.js');
|
||||
} catch (err) {
|
||||
console.error('[list-skipped-tests] Unable to resolve vitest binary:', err.message);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
const vitestBin = resolveVitestBin();
|
||||
const nodeExec = process.execPath; // Use current Node runtime
|
||||
|
||||
// Always pass explicit config to ensure identical file set as normal test run.
|
||||
// Use 'run' subcommand to execute once (no watch) and JSON reporter for machine parsing.
|
||||
const args = [vitestBin, 'run', '--config', '../vitest.config.mjs', '--reporter=json'];
|
||||
const child = spawn(nodeExec, args, { stdio: ['ignore', 'pipe', 'inherit'] });
|
||||
let jsonBlock = '';
|
||||
child.stdout.on('data', d => {
|
||||
const text = d.toString();
|
||||
// Capture last JSON object emitted by vitest reporter (it prints progress lines + final JSON)
|
||||
jsonBlock += text;
|
||||
});
|
||||
// eslint-disable-next-line no-unused-vars
|
||||
child.on('close', _code => {
|
||||
// Attempt to find the final JSON object (Vitest prints *only* JSON in our current mode but be defensive)
|
||||
const match = jsonBlock.match(/(\{[\s\S]*\})\s*$/);
|
||||
if (!match) {
|
||||
console.error('[list-skipped-tests] Failed to parse Vitest JSON output');
|
||||
process.exit(2);
|
||||
}
|
||||
let report;
|
||||
try {
|
||||
report = JSON.parse(match[1]);
|
||||
} catch (e) {
|
||||
console.error('[list-skipped-tests] JSON parse error', e);
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
// Vitest JSON reporter structure (observed):
|
||||
// { numTotalTests, testResults: [ { name, assertionResults: [ { title, status } ] } ] }
|
||||
// Legacy / alternative structure: { testFiles: [ { file, tests:[{ state }] } ] }
|
||||
const skipped = [];
|
||||
let totalFiles = 0;
|
||||
|
||||
if (Array.isArray(report.testResults)) {
|
||||
totalFiles = report.testResults.length;
|
||||
for (const tr of report.testResults) {
|
||||
const filePath = tr.name || tr.file || 'unknown';
|
||||
(tr.assertionResults || []).forEach(ar => {
|
||||
// Vitest marks skipped tests with status === 'skipped'. Support 'todo' & 'pending' for completeness.
|
||||
if (ar.status === 'skipped' || ar.status === 'todo' || ar.status === 'pending') {
|
||||
skipped.push({ file: filePath, test: ar.fullName || ar.title, state: ar.status });
|
||||
}
|
||||
});
|
||||
}
|
||||
} else if (Array.isArray(report.testFiles)) {
|
||||
// fallback structure
|
||||
totalFiles = report.testFiles.length;
|
||||
for (const f of report.testFiles) {
|
||||
if (!f) continue;
|
||||
const filePath = f.file || f.name || 'unknown';
|
||||
(f.tests || []).forEach(t => {
|
||||
if (t.state === 'skip' || t.state === 'todo' || t.state === 'pending') {
|
||||
skipped.push({ file: filePath, test: t.name, state: t.state });
|
||||
}
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.error('[list-skipped-tests] Unrecognized Vitest JSON structure');
|
||||
process.exit(2);
|
||||
}
|
||||
|
||||
const summary = { totalFiles, skippedCount: skipped.length, skipped };
|
||||
console.log(JSON.stringify(summary, null, 2));
|
||||
process.exit(skipped.length > 0 ? 1 : 0);
|
||||
});
|
||||
Reference in new issue
Block a user