Merge pull request #1849 from PR0M3TH3AN/fix-ci-failures-1694094349815692323

Fix CI lint (check-hex) and uploadModal integration test failures
This commit is contained in:
thePR0M3TH3AN authored and GitHub committed 2026-01-27 16:28:23 -05:00
commit 078d53e6bb
2 files changed
+53 -42

No files matched your search

+41 -34
View File
@@ -8,54 +8,61 @@ import { spawnSync } from "node:child_process";
const SEARCH_PATTERN = '(?<!&|[\\w])#[0-9a-fA-F]{3,8}\\b';
// Allow-list tokens and vector logos so brand assets can keep their baked colors.
// These are translated to git pathspec exclusions.
const IGNORED_GLOBS = [
'!css/tokens.css',
'!**/*.svg',
'!**/node_modules/**',
'!.git/**',
'!**/*.min.js',
'!**/*.map',
'!css/tailwind.generated.css',
'!dist/**',
'!build/**',
'!vendor/**',
'!js/utils/qrcode.js',
'!**/dist/**',
'!REMEDIATION_REPORT.md',
'!CHANGELOG.md',
'!scripts/daily-design-system-audit.mjs',
'!config/instance-config.js',
'!config/validate-config.js',
'!js/embed.js',
'!tests/unit/embed-accent.test.mjs',
'!tests/visual/embed-layout.spec.ts',
'!ai/**'
'css/tokens.css',
'**/*.svg',
'**/node_modules/**',
'.git/**',
'**/*.min.js',
'**/*.map',
'css/tailwind.generated.css',
'dist/**',
'build/**',
'vendor/**',
'js/utils/qrcode.js',
'**/dist/**',
'REMEDIATION_REPORT.md',
'CHANGELOG.md',
'scripts/daily-design-system-audit.mjs',
'config/instance-config.js',
'config/validate-config.js',
'js/embed.js',
'tests/unit/embed-accent.test.mjs',
'tests/visual/embed-layout.spec.ts',
'ai/**',
'**/*.ai'
];
const rgArgs = [
'--color=never',
'--no-heading',
const gitArgs = [
'grep',
'-n',
'-P' // Enable PCRE2 for lookbehind support
'-I', // Ignore binary files
'-P', // Enable PCRE2 for lookbehind support
SEARCH_PATTERN,
'--',
'.'
];
// Add exclusions
for (const glob of IGNORED_GLOBS) {
rgArgs.push('--glob', glob);
gitArgs.push(`:(exclude)${glob}`);
}
rgArgs.push('--regexp', SEARCH_PATTERN, '.');
const result = spawnSync('rg', rgArgs, { encoding: 'utf8' });
// We rely on 'git' being available and 'git grep' supporting -P.
// Typically available in most CI/dev environments.
const result = spawnSync('git', gitArgs, { encoding: 'utf8' });
if (result.error) {
console.error('Failed to execute ripgrep:', result.error.message);
console.error('Failed to execute git grep:', result.error.message);
process.exit(2);
}
// ripgrep exits with:
// 0 when matches are found,
// 1 when no matches are found,
// git grep exits with:
// 0 when matches are found (failure for us),
// 1 when no matches are found (success for us),
// 2+ on errors.
if (result.status === 0 && result.stdout.trim()) {
console.error('Hex colors detected outside tokens or SVG assets:');
console.error(result.stdout.trimEnd());
@@ -64,7 +71,7 @@ if (result.status === 0 && result.stdout.trim()) {
}
if (result.status && result.status !== 1) {
console.error('ripgrep reported an error while scanning for hex values.');
console.error('git grep reported an error while scanning for hex values.');
if (result.stderr) {
console.error(result.stderr.trimEnd());
}
+12 -8
View File
@@ -1,4 +1,4 @@
import { test, describe, it, before, after } from "node:test";
import { test, describe, it, before, after, beforeEach } from "node:test";
import assert from "node:assert";
import { createUiDom } from "./helpers/jsdom-test-helpers.mjs";
@@ -108,6 +108,13 @@ describe("UploadModal Integration", () => {
if (dom) dom.cleanup();
});
beforeEach(() => {
// Ensure clean DOM state
if (global.document && global.document.body) {
global.document.body.innerHTML = '';
}
});
it("should detect default R2 connection and show summary when loaded and unlocked", async () => {
// Setup Mock Data
const pubkey = "pk1";
@@ -170,13 +177,10 @@ describe("UploadModal Integration", () => {
meta: { bucket: "locked-bucket" }
}];
// Setup DOM - Reuse existing container or create if missing (cleaned by load)
let container = document.getElementById("modalContainer");
if (!container) {
container = document.createElement("div");
container.id = "modalContainer";
document.body.appendChild(container);
}
// Setup DOM - Create new container
const container = document.createElement("div");
container.id = "modalContainer";
document.body.appendChild(container);
// Re-instantiate
const modal = new UploadModal({