mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-12 06:12:18 +00:00
Keep local directories out of the acceptance report
This commit is contained in:
1 parent
6ba67d01af
commit
ef174b0ff7
1 file changed
+20
-4
@@ -124,6 +124,18 @@ const scrubbed = () => ({
|
|||||||
...Object.fromEntries(envNames().map((name) => [name, ''])),
|
...Object.fromEntries(envNames().map((name) => [name, ''])),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// The report names no local directory: the output, the served checkout and
|
||||||
|
// this repository become placeholders (logs carry stack traces).
|
||||||
|
const machinePaths = (text) => {
|
||||||
|
let out = String(text);
|
||||||
|
for (const [path, name] of [
|
||||||
|
[served?.scratch, '<scratch>'],
|
||||||
|
[output, '<output>'],
|
||||||
|
[root.replace(/\/$/, ''), '<repo>'],
|
||||||
|
])
|
||||||
|
if (path) out = out.split(path).join(name);
|
||||||
|
return out;
|
||||||
|
};
|
||||||
let served = null;
|
let served = null;
|
||||||
let preview = null;
|
let preview = null;
|
||||||
const cleanup = () => {
|
const cleanup = () => {
|
||||||
@@ -155,6 +167,7 @@ if (flag('serve')) {
|
|||||||
git('worktree', 'add', '--detach', worktree, commit);
|
git('worktree', 'add', '--detach', worktree, commit);
|
||||||
symlinkSync(join(root, 'node_modules'), join(worktree, 'node_modules'));
|
symlinkSync(join(root, 'node_modules'), join(worktree, 'node_modules'));
|
||||||
served = {
|
served = {
|
||||||
|
scratch,
|
||||||
commit,
|
commit,
|
||||||
worktree,
|
worktree,
|
||||||
dist,
|
dist,
|
||||||
@@ -454,7 +467,7 @@ const report = {
|
|||||||
const save = () =>
|
const save = () =>
|
||||||
writeFileSync(
|
writeFileSync(
|
||||||
join(output, 'acceptance.json'),
|
join(output, 'acceptance.json'),
|
||||||
JSON.stringify(report, null, 2) + '\n',
|
machinePaths(JSON.stringify(report, null, 2)) + '\n',
|
||||||
);
|
);
|
||||||
save();
|
save();
|
||||||
|
|
||||||
@@ -492,12 +505,15 @@ for (const [label, name, layers, extra = [], seconds = 300, external] of runs) {
|
|||||||
: run.error?.code === 'ETIMEDOUT'
|
: run.error?.code === 'ETIMEDOUT'
|
||||||
? 'timeout'
|
? 'timeout'
|
||||||
: 'fail';
|
: 'fail';
|
||||||
const log =
|
const log = machinePaths(
|
||||||
(run.stdout || '') + (run.stderr || '') + (run.error?.message || '');
|
(run.stdout || '') + (run.stderr || '') + (run.error?.message || ''),
|
||||||
|
);
|
||||||
writeFileSync(join(output, label + '.log'), log);
|
writeFileSync(join(output, label + '.log'), log);
|
||||||
const manifest = existsSync(evidence)
|
const manifest = existsSync(evidence)
|
||||||
? JSON.parse(readFileSync(evidence, 'utf8'))
|
? JSON.parse(machinePaths(readFileSync(evidence, 'utf8')))
|
||||||
: null;
|
: null;
|
||||||
|
if (manifest)
|
||||||
|
writeFileSync(evidence, JSON.stringify(manifest, null, 2) + '\n');
|
||||||
scenarios.push({
|
scenarios.push({
|
||||||
label,
|
label,
|
||||||
script,
|
script,
|
||||||
|
|||||||
Reference in new issue
Block a user