Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add system/os data #527

Merged
merged 3 commits into from
Oct 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"test:browser:other": "npx d2l-test-runner --files \"./test/browser/**/*.test.js\"",
"test:browser:ctor": "npx d2l-test-runner --config ./test/browser/ctor.config.js",
"test:server": "mocha './test/server/**/*.test.js'",
"test:vdiff": "npx d2l-test-runner vdiff --config ./test/browser/vdiff.config.js"
"test:vdiff": "npx d2l-test-runner vdiff $npm_config_sub --config ./test/browser/vdiff.config.js"
},
"bin": {
"d2l-test-runner": "./bin/d2l-test-runner.js",
Expand Down
18 changes: 18 additions & 0 deletions src/server/report/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,23 @@ class App extends LitElement {
<ul>${browserDiffs}</ul>
</div>
` : nothing;

const systemDiffs = Object.entries(data.system).reduce((acc, [k, v]) => {
const previous = data.system.previous[k] || 'unknown';
if (k === 'previous' || previous === v) {
return acc;
}
return acc.push(html`
<li>${k}: <strong>${data.system.previous[k]}</strong> to <strong>${v}</strong></li>
`) && acc;
}, []);
const systemDiffInfo = systemDiffs.length ? html`
<div class="browser-diff">
<div class="browser-diff-title">System Changes</div>
<ul>${systemDiffs}</ul>
</div>
` : nothing;

const byteDiffFilter = (data.numByteDiff > 0) ? html`
<fieldset>
<legend>Byte Diffs</legend>
Expand All @@ -271,6 +288,7 @@ class App extends LitElement {
${byteDiffFilter}
${browserFilter}
${browserDiffInfo}
${systemDiffInfo}
`;

}
Expand Down
13 changes: 12 additions & 1 deletion src/server/visual-diff-reporter.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import * as os from 'node:os';
import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { env } from 'node:process';
Expand Down Expand Up @@ -59,14 +60,24 @@ function createData(rootDir, updateGoldens, sessions) {
});
});

const system = {
platform: os.platform(),
release: os.release(),
arch: os.arch()
};

if (isCI || updateGoldens) {
metadata.browsers = Array.from(browsers.values()).map(b => {
return { name: b.name, version: b.version };
});
metadata.system = system;
writeFileSync(metadataPath, `${JSON.stringify(metadata, undefined, '\t')}\n`);
}

return { browsers, files, numByteDiff, numFailed, numTests };
const { previous: gc, ...previous } = metadata.system;
system.previous = previous;

return { browsers, files, numByteDiff, numFailed, numTests, system };

}

Expand Down