fix(tests): harness results name the build relative to the repository; absolute local paths redacted from committed results

This commit is contained in:
bchanot committed 2026-10-21 16:30:11 +02:00
1 parent 5b255e9857
commit 3ed8ebb79f
13 files changed
+22 -15

No files matched your search

+10 -3
View File
@@ -1,8 +1,8 @@
import { execFileSync } from 'node:child_process'
import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs'
import { join } from 'node:path'
import { join, sep } from 'node:path'
import { sha256 } from './inputs.mjs'
import { DIST_DIR, REPO_ROOT } from './paths.mjs'
import { DIST_DIR, REPO_ROOT, relativeToRepo } from './paths.mjs'
/**
* The harness measures a production build that embeds the reference sheet.
@@ -29,6 +29,13 @@ function assetSize(pattern) {
}
}
// Results are committed: name the build by its place in the repository,
// never by the machine's absolute path (it carries the user's home).
function reportedDistDir() {
if (DIST_DIR.startsWith(REPO_ROOT + sep)) return relativeToRepo(DIST_DIR)
return '<FAUNOSTEO_DIST, outside the repository>'
}
function headCommit() {
try {
const args = ['-C', REPO_ROOT, 'rev-parse', '--short', 'HEAD']
@@ -48,7 +55,7 @@ export function checkBuild() {
throw new Error(`the build carries no sheet: run ${BUILD_COMMAND}`)
}
return {
distDir: DIST_DIR,
distDir: reportedDistDir(),
builtAt: statSync(index).mtime.toISOString(),
sheetChunk: sheet,
entryChunk: assetSize(/^index-.*\.js$/),