From 820c7c1e615f68217f959b729fbfa50fd26c05b7 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Fri, 25 Oct 2024 17:27:22 -0400 Subject: [PATCH 1/3] Add system/os data --- package.json | 2 +- src/server/report/app.js | 18 ++++++++++++++++++ src/server/visual-diff-reporter.js | 19 ++++++++++++++++++- 3 files changed, 37 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 4e00f10c..43ba61a9 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/server/report/app.js b/src/server/report/app.js index bdfb1131..c6bf8447 100644 --- a/src/server/report/app.js +++ b/src/server/report/app.js @@ -253,6 +253,23 @@ class App extends LitElement { ` : 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` +
  • ${k}: ${data.system.previous[k]} to ${v}
  • + `) && acc; + }, []); + const systemDiffInfo = systemDiffs.length ? html` +
    +
    System Changes
    + +
    + ` : nothing; + const byteDiffFilter = (data.numByteDiff > 0) ? html`
    Byte Diffs @@ -271,6 +288,7 @@ class App extends LitElement { ${byteDiffFilter} ${browserFilter} ${browserDiffInfo} + ${systemDiffInfo} `; } diff --git a/src/server/visual-diff-reporter.js b/src/server/visual-diff-reporter.js index 3f4c5a5c..17bce1c3 100644 --- a/src/server/visual-diff-reporter.js +++ b/src/server/visual-diff-reporter.js @@ -1,5 +1,6 @@ import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; +import * as os from 'node:os'; import { env } from 'node:process'; import { execSync } from 'node:child_process'; import { fileURLToPath } from 'node:url'; @@ -59,14 +60,30 @@ function createData(rootDir, updateGoldens, sessions) { }); }); + const system = { + platform: os.platform(), + release: os.release(), + arch: os.arch(), + previous: metadata.system && { + platform: metadata.system.platform, + release: metadata.system.release, + arch: metadata.system.arch + } + }; + if (isCI || updateGoldens) { metadata.browsers = Array.from(browsers.values()).map(b => { return { name: b.name, version: b.version }; }); + metadata.system = { + platform: system.platform, + release: system.release, + arch: system.arch + }; writeFileSync(metadataPath, `${JSON.stringify(metadata, undefined, '\t')}\n`); } - return { browsers, files, numByteDiff, numFailed, numTests }; + return { browsers, files, numByteDiff, numFailed, numTests, system }; } From c67d74f0de1de704d930726d369f22639e0efb27 Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Mon, 28 Oct 2024 09:26:07 -0400 Subject: [PATCH 2/3] Cleanup --- src/server/visual-diff-reporter.js | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/server/visual-diff-reporter.js b/src/server/visual-diff-reporter.js index 17bce1c3..c2dc30b9 100644 --- a/src/server/visual-diff-reporter.js +++ b/src/server/visual-diff-reporter.js @@ -1,6 +1,6 @@ +import * as os from 'node:os'; import { cpSync, existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from 'node:fs'; import { dirname, join } from 'node:path'; -import * as os from 'node:os'; import { env } from 'node:process'; import { execSync } from 'node:child_process'; import { fileURLToPath } from 'node:url'; @@ -63,26 +63,20 @@ function createData(rootDir, updateGoldens, sessions) { const system = { platform: os.platform(), release: os.release(), - arch: os.arch(), - previous: metadata.system && { - platform: metadata.system.platform, - release: metadata.system.release, - arch: metadata.system.arch - } + arch: os.arch() }; if (isCI || updateGoldens) { metadata.browsers = Array.from(browsers.values()).map(b => { return { name: b.name, version: b.version }; }); - metadata.system = { - platform: system.platform, - release: system.release, - arch: system.arch - }; + metadata.system = system; writeFileSync(metadataPath, `${JSON.stringify(metadata, undefined, '\t')}\n`); } + const { previous: gc, ...previous } = metadata.system; + system.previous = previous; + return { browsers, files, numByteDiff, numFailed, numTests, system }; } From 36a61326e73ddc2791b3b4053da32d4a96a04e1b Mon Sep 17 00:00:00 2001 From: Danny Gleckler Date: Mon, 28 Oct 2024 10:49:03 -0400 Subject: [PATCH 3/3] Bump eslint-config-brightspace --- package-lock.json | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/package-lock.json b/package-lock.json index a28b3f96..74ec065f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -4090,11 +4090,10 @@ } }, "node_modules/eslint-config-brightspace": { - "version": "1.2.1", - "resolved": "https://registry.npmjs.org/eslint-config-brightspace/-/eslint-config-brightspace-1.2.1.tgz", - "integrity": "sha512-48P/5ZIfVEixNpOm9ZOKu4/X3a2JHou3Am7GQL7DLdcG2Kxn467KclvZrUqUcH2LMIxnMc8MCr71s6yoez/0fw==", + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/eslint-config-brightspace/-/eslint-config-brightspace-1.2.2.tgz", + "integrity": "sha512-xQhWXutfJ1SY9jzO/6fIanzU9gevZSsJpILkB8GDNJzj0/doOr2U0wXJIvfgGRQfioAudMdiFyU2f8BIyyA6wg==", "dev": true, - "license": "Apache-2.0", "peerDependencies": { "@babel/eslint-parser": ">= 7", "eslint": ">= 7",