Attempt to fix tests

This commit is contained in:
Pieter Vander Vennet 2024-01-13 02:09:42 +01:00
parent e7cecc26d9
commit 2576931a2b

View file

@ -76,13 +76,14 @@ function _arrayBufferToBase64(buffer) {
return btoa(binary) return btoa(binary)
} }
const cachedHashes: Record<string, string> = {}
async function validateScriptIntegrityOf(path: string): Promise<void> { async function validateScriptIntegrityOf(path: string): Promise<void> {
const htmlContents = readFileSync(path, "utf8") const htmlContents = readFileSync(path, "utf8")
const doc = parse_html(htmlContents) const doc = parse_html(htmlContents)
// @ts-ignore // @ts-ignore
const scripts = Array.from(doc.getElementsByTagName("script")) const scripts = Array.from(doc.getElementsByTagName("script"))
// Maps source URL onto hash // Maps source URL onto hash
const cachedHashes: Record<string, string> = {}
const failed = new Set<string>() const failed = new Set<string>()
for (const script of scripts) { for (const script of scripts) {
let src = script.getAttribute("src") let src = script.getAttribute("src")