Skip to content

Commit

Permalink
chore(deps-dev): bump html-validate from 7.18.0 to 8.0.5 (#9089)
Browse files Browse the repository at this point in the history
  • Loading branch information
dependabot[bot] authored Jul 18, 2023
1 parent db086f5 commit c77a3eb
Show file tree
Hide file tree
Showing 11 changed files with 48 additions and 50 deletions.
4 changes: 2 additions & 2 deletions kumascript/tests/macros/Compat.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,14 @@ describeMacro("Compat", function () {
itMacro("Outputs valid HTML", async (macro) => {
macro.ctx.env["browser-compat"] = "api.feature";
const result = await macro.call();
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});

itMacro("Accepts an array", async (macro) => {
macro.ctx.env["browser-compat"] = ["api.feature1", "api.feature2"];
const result = await macro.call();
const dom = JSDOM.fragment(result);
assert.equal(dom.querySelectorAll("div.bc-data").length, 2);
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});
});
8 changes: 4 additions & 4 deletions kumascript/tests/macros/DefaultAPISidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,9 +242,9 @@ function checkSubList(name, config, details, checker, next) {
* config.expected contains the expected results, and we use other bits
* of config, most notably locale.
*/
function checkResult(html, config) {
async function checkResult(html, config) {
// Lint the HTML
expect(lintHTML(html)).toBeFalsy();
expect(await lintHTML(html)).toBeFalsy();

const dom = JSDOM.fragment(html);
// Check that all links reference the proper locale or use https
Expand Down Expand Up @@ -285,8 +285,8 @@ function testMacro(config) {
macro.ctx.page.subpagesExpand = jest.fn(() => {
return config.subpages;
});
return macro.call(config.argument).then(function (result) {
checkResult(result, config);
return macro.call(config.argument).then(async function (result) {
await checkResult(result, config);
});
});
}
Expand Down
8 changes: 4 additions & 4 deletions kumascript/tests/macros/HTTPSidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,17 +78,17 @@ describeMacro("HTTPSidebar", function () {

itMacro("Creates a sidebar object for en-US", function (macro) {
macro.ctx.env.locale = "en-US";
return macro.call().then(function (result) {
expect(lintHTML(result)).toBeFalsy();
return macro.call().then(async function (result) {
expect(await lintHTML(result)).toBeFalsy();
const dom = JSDOM.fragment(result);
checkSidebarDom(dom, "en-US");
});
});

itMacro("Creates a sidebar object for es", function (macro) {
macro.ctx.env.locale = "es";
return macro.call().then(function (result) {
expect(lintHTML(result)).toBeFalsy();
return macro.call().then(async function (result) {
expect(await lintHTML(result)).toBeFalsy();
const dom = JSDOM.fragment(result);
checkSidebarDom(dom, "es");
});
Expand Down
8 changes: 4 additions & 4 deletions kumascript/tests/macros/ListGroups.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ function compareNode(actual, expected) {
/**
* This is the entry point for checking the result of a test.
*/
function checkResult(html) {
expect(lintHTML(html)).toBeFalsy();
async function checkResult(html) {
expect(await lintHTML(html)).toBeFalsy();
const actualDOM = JSDOM.fragment(html);
const actualNodes = actualDOM.querySelectorAll("*");
const expectedDOM = JSDOM.fragment(expectedHTML);
Expand All @@ -98,8 +98,8 @@ function checkResult(html) {

function testMacro() {
itMacro("Test ListGroups macro", (macro) => {
return macro.call().then((result) => {
checkResult(result);
return macro.call().then(async (result) => {
await checkResult(result);
});
});
}
Expand Down
8 changes: 4 additions & 4 deletions kumascript/tests/macros/Specifications.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ describeMacro("Specifications", function () {
itMacro("Outputs valid HTML (browser-compat case)", async (macro) => {
macro.ctx.env["browser-compat"] = "api.feature";
const result = await macro.call();
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});

itMacro("Outputs valid HTML (spec-urls case)", async (macro) => {
macro.ctx.env["spec-urls"] = "https://example.com";
const result = await macro.call();
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});

itMacro("Accepts an array from browser-compat", async (macro) => {
Expand All @@ -52,7 +52,7 @@ describeMacro("Specifications", function () {
.split(",").length,
2
);
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});

itMacro("Accepts an array from spec-urls", async (macro) => {
Expand All @@ -66,6 +66,6 @@ describeMacro("Specifications", function () {
.split(",").length,
2
);
expect(lintHTML(result)).toBeFalsy();
expect(await lintHTML(result)).toBeFalsy();
});
});
12 changes: 6 additions & 6 deletions kumascript/tests/macros/addonsidebar.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,9 @@ function getMockResultForGetChildren(doc_url) {
];
}

function checkSidebarResult(html, locale) {
async function checkSidebarResult(html, locale) {
// Lint the HTML
expect(lintHTML(html)).toBeFalsy();
expect(await lintHTML(html)).toBeFalsy();
const dom = JSDOM.fragment(html);
const section = dom.querySelector("section#Quick_links");

Expand Down Expand Up @@ -144,17 +144,17 @@ describeMacro("AddonSidebar", function () {
itMacro(`with locale ${locale}`, function (macro) {
macro.ctx.env.locale = locale;
macro.ctx.env.slug = "Mozilla/Add-ons/AMO";
return macro.call().then(function (result) {
return macro.call().then(async function (result) {
expect(macro.ctx.template).toHaveBeenCalledTimes(1);
checkSidebarResult(result, locale);
await checkSidebarResult(result, locale);
});
});
itMacro(`with locale ${locale} under WebExtensions/API`, function (macro) {
macro.ctx.env.locale = locale;
macro.ctx.env.slug = "Mozilla/Add-ons/WebExtensions/API/alarms";
return macro.call().then(function (result) {
return macro.call().then(async function (result) {
expect(macro.ctx.template).toHaveBeenCalledTimes(1);
checkSidebarResult(result, locale);
await checkSidebarResult(result, locale);
});
});
}
Expand Down
12 changes: 6 additions & 6 deletions kumascript/tests/macros/apiref.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,9 @@ function checkItemList(
* config.expected contains the expected results, and we use other bits
* of config, most notably locale
*/
function checkResult(html, config) {
async function checkResult(html, config) {
// Lint the HTML
expect(lintHTML(html)).toBeFalsy();
expect(await lintHTML(html)).toBeFalsy();

const dom = JSDOM.fragment(html);
// Check that all links reference the proper locale or use https
Expand Down Expand Up @@ -663,12 +663,12 @@ function testMacro(config) {
throw new Error(`Unimplmeneted mock fixture ${name}`);
});
if (config.argument) {
return macro.call(config.argument).then(function (result) {
checkResult(result, config);
return macro.call(config.argument).then(async function (result) {
await checkResult(result, config);
});
}
return macro.call().then(function (result) {
checkResult(result, config);
return macro.call().then(async function (result) {
await checkResult(result, config);
});
});
}
Expand Down
8 changes: 4 additions & 4 deletions kumascript/tests/macros/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ const ERROR_TEST_CASES = [

describe("test lintHTML function", function () {
for (const test of ERROR_TEST_CASES) {
it(test.title, function () {
expect(lintHTML(test.html)).toContain(test.error);
it(test.title, async function () {
expect(await lintHTML(test.html)).toContain(test.error);
});
}
it("with valid HTML input", function () {
expect(lintHTML("<div>This is nice</div>")).toBeFalsy();
it("with valid HTML input", async function () {
expect(await lintHTML("<div>This is nice</div>")).toBeFalsy();
});
});
4 changes: 2 additions & 2 deletions kumascript/tests/macros/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ export function afterEachMacro(teardown) {
* @param {boolean} fragment
*/
let htmlValidator = null; // global cache
export function lintHTML(html) {
export async function lintHTML(html) {
if (!htmlValidator) {
htmlValidator = new HtmlValidate({
extends: ["html-validate:recommended"],
Expand All @@ -176,7 +176,7 @@ export function lintHTML(html) {
},
});
}
const report = htmlValidator.validateString(html);
const report = await htmlValidator.validateString(html);
if (report.valid) {
return null;
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"file-loader": "^6.2.0",
"foreman": "^3.0.1",
"history": "^5.2.0",
"html-validate": "^7.18.0",
"html-validate": "^8.0.5",
"html-webpack-plugin": "^5.5.3",
"husky": "^8.0.3",
"identity-obj-proxy": "^3.0.0",
Expand Down
24 changes: 11 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1776,10 +1776,10 @@
lodash.isundefined "^3.0.1"
lodash.uniq "^4.5.0"

"@html-validate/stylish@^4.0.1":
version "4.0.1"
resolved "https://registry.yarnpkg.com/@html-validate/stylish/-/stylish-4.0.1.tgz#1717e93ec6e3f1acf9bd86e1bfaaeeef748d1d45"
integrity sha512-BBZuKxYAbf9yddzn5eboV3LR9tF0KAJACkxH9+g0C9mhxIInPHtLhsXdDMyhRBY49Ls9TLjAuPKbuSUgLjclBA==
"@html-validate/stylish@^4.1.0":
version "4.1.0"
resolved "https://registry.yarnpkg.com/@html-validate/stylish/-/stylish-4.1.0.tgz#2683b64c3e845e413c86912c6239f7168e8fb941"
integrity sha512-f2MOKJ2HVdLxpOOg2jD6hjDTDJic3wpb8/UdDDIic5jTvgfMMPN3PoiNWlqDg/mCzLIj1b/p1hCRx4Kz5lbVjw==
dependencies:
kleur "^4.0.0"

Expand Down Expand Up @@ -3482,7 +3482,7 @@ acorn-jsx@^5.3.2:
resolved "https://registry.yarnpkg.com/acorn-jsx/-/acorn-jsx-5.3.2.tgz#7ed5bb55908b3b2f1bc55c6af1653bada7f07937"
integrity sha512-rq9s+JNhf0IChjtDXxllJ7g41oZk5SlXtp0LHwyA5cejwn7vKmKp4pPri6YEePv2PU65sAsegbXtIinmDFDXgQ==

acorn-walk@^8.0.0, acorn-walk@^8.0.2, acorn-walk@^8.1.1:
acorn-walk@^8.0.2, acorn-walk@^8.1.1:
version "8.2.0"
resolved "https://registry.yarnpkg.com/acorn-walk/-/acorn-walk-8.2.0.tgz#741210f2e2426454508853a2f44d0ab83b7f69c1"
integrity sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==
Expand Down Expand Up @@ -6281,7 +6281,7 @@ eslint@^8.45.0:
strip-ansi "^6.0.1"
text-table "^0.2.0"

espree@^9.0.0, espree@^9.6.0:
espree@^9.6.0:
version "9.6.0"
resolved "https://registry.yarnpkg.com/espree/-/espree-9.6.0.tgz#80869754b1c6560f32e3b6929194a3fe07c5b82f"
integrity sha512-1FH/IiruXZ84tpUlm0aCUEwMl2Ho5ilqVh0VvQXw+byAz/4SAciyHLlfmL5WYqsvD38oymdUwBss0LtK8m4s/A==
Expand Down Expand Up @@ -7596,18 +7596,16 @@ html-tags@^3.3.1:
resolved "https://registry.yarnpkg.com/html-tags/-/html-tags-3.3.1.tgz#a04026a18c882e4bba8a01a3d39cfe465d40b5ce"
integrity sha512-ztqyC3kLto0e9WbNp0aeP+M3kTt+nbaIveGmUxAtZa+8iFgKLUOD4YKM5j+f3QD89bra7UeumolZHKuOXnTmeQ==

html-validate@^7.18.0:
version "7.18.0"
resolved "https://registry.yarnpkg.com/html-validate/-/html-validate-7.18.0.tgz#14ad70edc4940452630d96e02f0695b96ee37d25"
integrity sha512-Ul8tPbrcpcV4XXx8aoWhx9ISRy0uCdhXyOz0MnnXt5IQ7sEyQFJJdY61Oysl8PKjE7JiR7SfLeyISPvQY8oS9Q==
html-validate@^8.0.5:
version "8.0.5"
resolved "https://registry.yarnpkg.com/html-validate/-/html-validate-8.0.5.tgz#f28432aa254acf5dc98c1c82b8c9a3bea0440da9"
integrity sha512-8IBayugyDTiH49JjxSEq+A0UFQzuyG9m0382aHMrPoHVNQcr3IypjuKcjn150ahAwAqO0o4NgMbkC1LezQU1mw==
dependencies:
"@babel/code-frame" "^7.10.0"
"@html-validate/stylish" "^4.0.1"
"@html-validate/stylish" "^4.1.0"
"@sidvind/better-ajv-errors" "^2.0.0"
acorn-walk "^8.0.0"
ajv "^8.0.0"
deepmerge "^4.2.0"
espree "^9.0.0"
glob "^10.0.0"
ignore "^5.0.0"
kleur "^4.1.0"
Expand Down

0 comments on commit c77a3eb

Please sign in to comment.