html-validate 8.9.1 → 8.11.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"matchers.js","sources":["../../src/jest/matchers/to-be-valid.ts","../../src/jest/matchers/to-be-invalid.ts","../../src/jest/matchers/to-htmlvalidate.ts","../../src/jest/matchers/to-have-error.ts","../../src/jest/matchers/to-have-errors.ts","../../src/jest/matchers/get-results.ts"],"sourcesContent":["import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): MatcherResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t} else {\n\t\t\tconst firstError = report.results[0].messages[0];\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => `Result should be valid but had error \"${firstError.message}\"`,\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeValid);\n}\n\nexport { createMatcher as toBeValid };\n","import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): MatcherResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => \"Result should be invalid but had no errors\",\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeInvalid);\n}\n\nexport { createMatcher as toBeInvalid };\n","import deepmerge from \"deepmerge\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Message } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\n\nfunction isMessage(arg: any): arg is Partial<Message> {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.ruleId ||\n\t\t\targ.severity ||\n\t\t\targ.message ||\n\t\t\targ.offset ||\n\t\t\targ.line ||\n\t\t\targ.column ||\n\t\t\targ.size ||\n\t\t\targ.selector ||\n\t\t\targ.context,\n\t);\n}\n\nfunction isConfig(arg: any): arg is ConfigData {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.root || arg.extends || arg.elements || arg.plugin || arg.transform || arg.rules,\n\t);\n}\n\nfunction isString(arg: any): arg is string {\n\treturn typeof arg === \"string\";\n}\n\nfunction getMarkup(src: unknown): string {\n\tif (typeof HTMLElement !== \"undefined\" && src instanceof HTMLElement) {\n\t\treturn (src as { outerHTML: string }).outerHTML;\n\t}\n\t/* istanbul ignore else: prototype only allows string or HTMLElement */\n\tif (typeof src === \"string\") {\n\t\treturn src;\n\t} else {\n\t\tthrow new Error(`Failed to get markup from \"${typeof src}\" argument`);\n\t}\n}\n\ntype Arg1 = Partial<Message> | ConfigData | string;\ntype Arg2 = ConfigData | string;\ntype Arg3 = string;\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherContext,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): MatcherResult {\n\t\tconst markup = getMarkup(actual);\n\t\tconst message = isMessage(arg0) ? arg0 : undefined;\n\t\tconst config = isConfig(arg0) ? arg0 : isConfig(arg1) ? arg1 : undefined;\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2;\n\t\treturn toHTMLValidateImpl.call(this, expect, diff, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\nfunction toHTMLValidateImpl(\n\tthis: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): MatcherResult {\n\tconst defaultConfig = {\n\t\trules: {\n\t\t\t/* jsdom normalizes style so disabling rule when using this matcher or it\n\t\t\t * gets quite noisy when configured with self-closing */\n\t\t\t\"void-style\": \"off\",\n\t\t},\n\t};\n\tconst config = deepmerge(defaultConfig, userConfig ?? {});\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst actualFilename = filename ?? this.testPath ?? \"inline\";\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\tconst report = htmlvalidate.validateStringSync(actual, actualFilename, config);\n\tconst pass = report.valid;\n\tconst result = report.results[0];\n\tif (pass) {\n\t\treturn { pass, message: () => \"HTML is valid when an error was expected\" };\n\t} else {\n\t\tif (expectedError) {\n\t\t\tconst actual = result.messages;\n\t\t\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = diff\n\t\t\t\t? diff(expected, actual, {\n\t\t\t\t\t\texpand: this.expand,\n\t\t\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t\t })\n\t\t\t\t: /* istanbul ignore next */ undefined;\n\t\t\tconst hint = this.utils.matcherHint(\".not.toHTMLValidate\", undefined, undefined, {\n\t\t\t\tcomment: \"expected error\",\n\t\t\t});\n\t\t\tconst expectedErrorMessage = (): string =>\n\t\t\t\t[\n\t\t\t\t\thint,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Expected error to be present:\",\n\t\t\t\t\tthis.utils.printExpected(expectedError),\n\t\t\t\t\t/* istanbul ignore next */ diffString ? `\\n${diffString}` : \"\",\n\t\t\t\t].join(\"\\n\");\n\t\t\treturn { pass: !errorPass, message: expectedErrorMessage, actual, expected };\n\t\t}\n\n\t\tconst errors = result.messages.map((message) => ` ${message.message} [${message.ruleId}]`);\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () =>\n\t\t\t\t[\"Expected HTML to be valid but had the following errors:\", \"\"].concat(errors).join(\"\\n\"),\n\t\t};\n\t}\n}\n\nexport { createMatcher as toHTMLValidate };\n","import { type Message, type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { flattenMessages } from \"../utils/flatten-messages\";\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: Report,\n\texpected: Partial<Message>,\n): MatcherResult {\n\tconst flattened = flattenMessages(actual);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = diff\n\t\t? diff(matcher, flattened, { expand: context.expand })\n\t\t: /* istanbul ignore next */ undefined;\n\tconst hint = context.utils.matcherHint(\".toHaveError\");\n\tconst prettyExpected = context.utils.printExpected(matcher);\n\tconst prettyReceived = context.utils.printReceived(flattened);\n\tconst resultMessage = (): string => {\n\t\treturn [\n\t\t\thint,\n\t\t\t\"\",\n\t\t\t\"Expected error to equal:\",\n\t\t\t` ${prettyExpected}`,\n\t\t\t\"Received:\",\n\t\t\t` ${prettyReceived}`,\n\t\t\t/* istanbul ignore next */ diffString ? `\\nDifference:\\n\\n${diffString}` : \"\",\n\t\t].join(\"\\n\");\n\t};\n\treturn { pass, message: resultMessage, actual: flattened, expected: matcher };\n}\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, any?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: any,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: any,\n\t): MatcherResult {\n\t\tif (typeof arg1 === \"string\") {\n\t\t\tconst expected: Partial<Message> = {\n\t\t\t\truleId: arg1,\n\t\t\t\tmessage: arg2,\n\t\t\t};\n\t\t\tif (arg3) {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- this is supposed to accept anything */\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, arg1);\n\t\t}\n\t}\n\treturn diverge(toHaveError);\n}\n\nexport { createMatcher as toHaveError };\n","/* eslint-disable prefer-template -- technical debt, should be refactored */\n\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n\tflattenMessages,\n} from \"../utils\";\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherContext,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): MatcherResult {\n\t\tconst flattened = flattenMessages(report);\n\t\tconst matcher = errors.map((entry) => {\n\t\t\tif (Array.isArray(entry)) {\n\t\t\t\tconst [ruleId, message] = entry;\n\t\t\t\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\n\t\t\t\treturn expect.objectContaining(entry);\n\t\t\t}\n\t\t});\n\t\tconst pass = this.equals(flattened, matcher);\n\t\tconst diffString = diff\n\t\t\t? diff(matcher, flattened, { expand: this.expand })\n\t\t\t: /* istanbul ignore next */ undefined;\n\t\tconst resultMessage = (): string =>\n\t\t\tthis.utils.matcherHint(\".toHaveErrors\") +\n\t\t\t\"\\n\\n\" +\n\t\t\t\"Expected error to equal:\\n\" +\n\t\t\t` ${this.utils.printExpected(matcher)}\\n` +\n\t\t\t\"Received:\\n\" +\n\t\t\t` ${this.utils.printReceived(flattened)}` +\n\t\t\t/* istanbul ignore next */ (diffString ? `\\n\\nDifference:\\n\\n${diffString}` : \"\");\n\n\t\treturn { pass, message: resultMessage };\n\t}\n\treturn diverge(toHaveErrors);\n}\n\nexport { createMatcher as toHaveErrors };\n","import { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { type Report, type Result } from \"../../reporter\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst loader = new FileSystemConfigLoader({\n\t\t\textends: [\"html-validate:recommended\"],\n\t\t});\n\t\tconst htmlvalidate = new HtmlValidate(loader);\n\t\tconst report = htmlvalidate.validateStringSync(value, filename, {\n\t\t\trules: {\n\t\t\t\t\"void-style\": \"off\",\n\t\t\t},\n\t\t});\n\t\treturn report.results.map((it) => {\n\t\t\treturn { ...it, filePath: \"inline\" };\n\t\t});\n\t} else {\n\t\treturn value.results;\n\t}\n}\n"],"names":["createMatcher","actual"],"mappings":";;;;AAGA,SAASA,eAAgD,GAAA;AACxD,EAAA,SAAS,UAAU,MAA+B,EAAA;AACjD,IAAA,IAAI,OAAO,KAAO,EAA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AA,OAAO,EAAE,GAAG,EAAI,EAAA,QAAA,EAAU,QAAS,EAAA,CAAA;AAAA,KACnC,CAAA,CAAA;AAAA,GACK,MAAA;AACN,IAAA,OAAO,KAAM,CAAA,OAAA,CAAA;AAAA,GACd;AACD;;;;"}
1
+ {"version":3,"file":"matchers.js","sources":["../../src/jest/matchers/to-be-valid.ts","../../src/jest/matchers/to-be-invalid.ts","../../src/jest/matchers/to-htmlvalidate.ts","../../src/jest/matchers/to-have-error.ts","../../src/jest/matchers/to-have-errors.ts","../../src/jest/matchers/get-results.ts"],"sourcesContent":["import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeValid(report: Report): MatcherResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t} else {\n\t\t\tconst firstError = report.results[0].messages[0];\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => `Result should be valid but had error \"${firstError.message}\"`,\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeValid);\n}\n\nexport { createMatcher as toBeValid };\n","import { type Report } from \"../../reporter\";\nimport { type MatcherResult, type MaybeAsyncCallback, diverge } from \"../utils\";\n\nfunction createMatcher(): MaybeAsyncCallback<Report, []> {\n\tfunction toBeInvalid(report: Report): MatcherResult {\n\t\tif (report.valid) {\n\t\t\treturn {\n\t\t\t\tpass: false,\n\t\t\t\tmessage: () => \"Result should be invalid but had no errors\",\n\t\t\t};\n\t\t} else {\n\t\t\treturn {\n\t\t\t\tpass: true,\n\t\t\t\tmessage: /* istanbul ignore next */ () => \"Result should not contain error\",\n\t\t\t};\n\t\t}\n\t}\n\treturn diverge(toBeInvalid);\n}\n\nexport { createMatcher as toBeInvalid };\n","import deepmerge from \"deepmerge\";\nimport { type ConfigData } from \"../../config\";\nimport { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\nimport { type Message } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\n\nfunction isMessage(arg: any): arg is Partial<Message> {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.ruleId ||\n\t\t\targ.severity ||\n\t\t\targ.message ||\n\t\t\targ.offset ||\n\t\t\targ.line ||\n\t\t\targ.column ||\n\t\t\targ.size ||\n\t\t\targ.selector ||\n\t\t\targ.context,\n\t);\n}\n\nfunction isConfig(arg: any): arg is ConfigData {\n\tif (!arg) {\n\t\treturn false;\n\t}\n\treturn Boolean(\n\t\targ.root || arg.extends || arg.elements || arg.plugin || arg.transform || arg.rules,\n\t);\n}\n\nfunction isString(arg: any): arg is string {\n\treturn typeof arg === \"string\";\n}\n\nfunction getMarkup(src: unknown): string {\n\tif (typeof HTMLElement !== \"undefined\" && src instanceof HTMLElement) {\n\t\treturn (src as { outerHTML: string }).outerHTML;\n\t}\n\t/* istanbul ignore else: prototype only allows string or HTMLElement */\n\tif (typeof src === \"string\") {\n\t\treturn src;\n\t} else {\n\t\tthrow new Error(`Failed to get markup from \"${typeof src}\" argument`);\n\t}\n}\n\ntype Arg1 = Partial<Message> | ConfigData | string;\ntype Arg2 = ConfigData | string;\ntype Arg3 = string;\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<unknown, [Arg1?, Arg2?, Arg3?]> {\n\tfunction toHTMLValidate(\n\t\tthis: MatcherContext,\n\t\tactual: unknown,\n\t\targ0?: Arg1,\n\t\targ1?: Arg2,\n\t\targ2?: Arg3,\n\t): MatcherResult {\n\t\tconst markup = getMarkup(actual);\n\t\tconst message = isMessage(arg0) ? arg0 : undefined;\n\t\tconst config = isConfig(arg0) ? arg0 : isConfig(arg1) ? arg1 : undefined;\n\t\tconst filename = isString(arg0) ? arg0 : isString(arg1) ? arg1 : arg2;\n\t\treturn toHTMLValidateImpl.call(this, expect, diff, markup, message, config, filename);\n\t}\n\treturn diverge(toHTMLValidate);\n}\n\nfunction toHTMLValidateImpl(\n\tthis: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: string,\n\texpectedError?: Partial<Message>,\n\tuserConfig?: ConfigData,\n\tfilename?: string,\n): MatcherResult {\n\tconst defaultConfig = {\n\t\trules: {\n\t\t\t/* jsdom normalizes style so disabling rule when using this matcher or it\n\t\t\t * gets quite noisy when configured with self-closing */\n\t\t\t\"void-style\": \"off\",\n\t\t},\n\t};\n\tconst config = deepmerge(defaultConfig, userConfig ?? {});\n\t/* istanbul ignore next: cant figure out when this would be unset */\n\tconst actualFilename = filename ?? this.testPath ?? \"inline\";\n\tconst loader = new FileSystemConfigLoader({\n\t\textends: [\"html-validate:recommended\"],\n\t});\n\tconst htmlvalidate = new HtmlValidate(loader);\n\tconst report = htmlvalidate.validateStringSync(actual, actualFilename, config);\n\tconst pass = report.valid;\n\tconst result = report.results[0];\n\tif (pass) {\n\t\treturn { pass, message: () => \"HTML is valid when an error was expected\" };\n\t} else {\n\t\tif (expectedError) {\n\t\t\tconst actual = result.messages;\n\t\t\tconst expected = expect.arrayContaining([expect.objectContaining(expectedError)]);\n\t\t\tconst errorPass = this.equals(actual, expected);\n\t\t\tconst diffString = diff\n\t\t\t\t? diff(expected, actual, {\n\t\t\t\t\t\texpand: this.expand,\n\t\t\t\t\t\taAnnotation: \"Expected error\",\n\t\t\t\t\t\tbAnnotation: \"Actual error\",\n\t\t\t\t\t})\n\t\t\t\t: /* istanbul ignore next */ undefined;\n\t\t\tconst hint = this.utils.matcherHint(\".not.toHTMLValidate\", undefined, undefined, {\n\t\t\t\tcomment: \"expected error\",\n\t\t\t});\n\t\t\tconst expectedErrorMessage = (): string =>\n\t\t\t\t[\n\t\t\t\t\thint,\n\t\t\t\t\t\"\",\n\t\t\t\t\t\"Expected error to be present:\",\n\t\t\t\t\tthis.utils.printExpected(expectedError),\n\t\t\t\t\t/* istanbul ignore next */ diffString ? `\\n${diffString}` : \"\",\n\t\t\t\t].join(\"\\n\");\n\t\t\treturn { pass: !errorPass, message: expectedErrorMessage, actual, expected };\n\t\t}\n\n\t\tconst errors = result.messages.map((message) => ` ${message.message} [${message.ruleId}]`);\n\t\treturn {\n\t\t\tpass,\n\t\t\tmessage: () =>\n\t\t\t\t[\"Expected HTML to be valid but had the following errors:\", \"\"].concat(errors).join(\"\\n\"),\n\t\t};\n\t}\n}\n\nexport { createMatcher as toHTMLValidate };\n","import { type Message, type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n} from \"../utils\";\nimport { flattenMessages } from \"../utils/flatten-messages\";\n\nfunction toHaveErrorImpl(\n\tcontext: MatcherContext,\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n\tactual: Report,\n\texpected: Partial<Message>,\n): MatcherResult {\n\tconst flattened = flattenMessages(actual);\n\tconst matcher = [expect.objectContaining(expected)];\n\tconst pass = context.equals(flattened, matcher);\n\tconst diffString = diff\n\t\t? diff(matcher, flattened, { expand: context.expand })\n\t\t: /* istanbul ignore next */ undefined;\n\tconst hint = context.utils.matcherHint(\".toHaveError\");\n\tconst prettyExpected = context.utils.printExpected(matcher);\n\tconst prettyReceived = context.utils.printReceived(flattened);\n\tconst resultMessage = (): string => {\n\t\treturn [\n\t\t\thint,\n\t\t\t\"\",\n\t\t\t\"Expected error to equal:\",\n\t\t\t` ${prettyExpected}`,\n\t\t\t\"Received:\",\n\t\t\t` ${prettyReceived}`,\n\t\t\t/* istanbul ignore next */ diffString ? `\\nDifference:\\n\\n${diffString}` : \"\",\n\t\t].join(\"\\n\");\n\t};\n\treturn { pass, message: resultMessage, actual: flattened, expected: matcher };\n}\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n):\n\t| MaybeAsyncCallback<Report, [Partial<Message>]>\n\t| MaybeAsyncCallback<Report, [string, string, any?]> {\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\terror: Partial<Message>,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\truleId: string,\n\t\tmessage: string,\n\t\tcontext?: any,\n\t): MatcherResult;\n\tfunction toHaveError(\n\t\tthis: MatcherContext,\n\t\tactual: Report,\n\t\targ1: string | Partial<Message>,\n\t\targ2?: string,\n\t\targ3?: any,\n\t): MatcherResult {\n\t\tif (typeof arg1 === \"string\") {\n\t\t\tconst expected: Partial<Message> = {\n\t\t\t\truleId: arg1,\n\t\t\t\tmessage: arg2,\n\t\t\t};\n\t\t\tif (arg3) {\n\t\t\t\t/* eslint-disable-next-line @typescript-eslint/no-unsafe-assignment -- this is supposed to accept anything */\n\t\t\t\texpected.context = arg3;\n\t\t\t}\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, expected);\n\t\t} else {\n\t\t\treturn toHaveErrorImpl(this, expect, diff, actual, arg1);\n\t\t}\n\t}\n\treturn diverge(toHaveError);\n}\n\nexport { createMatcher as toHaveError };\n","/* eslint-disable prefer-template -- technical debt, should be refactored */\n\nimport { type Report } from \"../../reporter\";\nimport {\n\ttype DiffFunction,\n\ttype MatcherContext,\n\ttype MatcherExpect,\n\ttype MatcherResult,\n\ttype MaybeAsyncCallback,\n\tdiverge,\n\tflattenMessages,\n} from \"../utils\";\n\nfunction createMatcher(\n\texpect: MatcherExpect,\n\tdiff: DiffFunction | undefined,\n): MaybeAsyncCallback<Report, [Array<[string, string] | Record<string, unknown>>]> {\n\tfunction toHaveErrors(\n\t\tthis: MatcherContext,\n\t\treport: Report,\n\t\terrors: Array<[string, string] | Record<string, unknown>>,\n\t): MatcherResult {\n\t\tconst flattened = flattenMessages(report);\n\t\tconst matcher = errors.map((entry) => {\n\t\t\tif (Array.isArray(entry)) {\n\t\t\t\tconst [ruleId, message] = entry;\n\t\t\t\treturn expect.objectContaining({ ruleId, message });\n\t\t\t} else {\n\t\t\t\treturn expect.objectContaining(entry);\n\t\t\t}\n\t\t});\n\t\tconst pass = this.equals(flattened, matcher);\n\t\tconst diffString = diff\n\t\t\t? diff(matcher, flattened, { expand: this.expand })\n\t\t\t: /* istanbul ignore next */ undefined;\n\t\tconst resultMessage = (): string =>\n\t\t\tthis.utils.matcherHint(\".toHaveErrors\") +\n\t\t\t\"\\n\\n\" +\n\t\t\t\"Expected error to equal:\\n\" +\n\t\t\t` ${this.utils.printExpected(matcher)}\\n` +\n\t\t\t\"Received:\\n\" +\n\t\t\t` ${this.utils.printReceived(flattened)}` +\n\t\t\t/* istanbul ignore next */ (diffString ? `\\n\\nDifference:\\n\\n${diffString}` : \"\");\n\n\t\treturn { pass, message: resultMessage };\n\t}\n\treturn diverge(toHaveErrors);\n}\n\nexport { createMatcher as toHaveErrors };\n","import { FileSystemConfigLoader } from \"../../config/loaders/file-system\";\nimport { type Report, type Result } from \"../../reporter\";\nimport { HtmlValidate } from \"../../htmlvalidate\";\n\n/**\n * @internal\n */\nexport function getResults(filename: string, value: Report | string): Result[] {\n\tif (typeof value === \"string\") {\n\t\tconst loader = new FileSystemConfigLoader({\n\t\t\textends: [\"html-validate:recommended\"],\n\t\t});\n\t\tconst htmlvalidate = new HtmlValidate(loader);\n\t\tconst report = htmlvalidate.validateStringSync(value, filename, {\n\t\t\trules: {\n\t\t\t\t\"void-style\": \"off\",\n\t\t\t},\n\t\t});\n\t\treturn report.results.map((it) => {\n\t\t\treturn { ...it, filePath: \"inline\" };\n\t\t});\n\t} else {\n\t\treturn value.results;\n\t}\n}\n"],"names":["createMatcher","actual"],"mappings":";;;;AAGA,SAASA,eAAgD,GAAA;AACxD,EAAA,SAAS,U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AAA,CAAQ,GAAI,CAAA,CAAC,EAAO,KAAA;AACjC,MAAA,OAAO,EAAE,GAAG,EAAI,EAAA,QAAA,EAAU,QAAS,EAAA,CAAA;AAAA,KACnC,CAAA,CAAA;AAAA,GACK,MAAA;AACN,IAAA,OAAO,KAAM,CAAA,OAAA,CAAA;AAAA,GACd;AACD;;;;"}
@@ -93,9 +93,15 @@
93
93
  "implicitRole": {
94
94
  "title": "Implicit ARIA role for this element",
95
95
  "description": "Some elements have implicit ARIA roles.",
96
+ "deprecated": true,
96
97
  "function": true
97
98
  },
98
99
 
100
+ "aria": {
101
+ "title": "WAI-ARIA properties for this element",
102
+ "$ref": "#/definitions/Aria"
103
+ },
104
+
99
105
  "scriptSupporting": {
100
106
  "title": "Mark element as script-supporting",
101
107
  "description": "Script-supporting elements are elements which can be inserted where othersise not permitted to assist in templating",
@@ -184,6 +190,22 @@
184
190
  },
185
191
 
186
192
  "definitions": {
193
+ "Aria": {
194
+ "type": "object",
195
+ "additionalProperties": false,
196
+ "properties": {
197
+ "implicitRole": {
198
+ "title": "Implicit ARIA role for this element",
199
+ "description": "Some elements have implicit ARIA roles.",
200
+ "anyOf": [{ "type": "string" }, { "function": true }]
201
+ },
202
+ "naming": {
203
+ "title": "Prohibit or allow this element to be named by aria-label or aria-labelledby",
204
+ "anyOf": [{ "type": "string", "enum": ["prohibited", "allowed"] }, { "function": true }]
205
+ }
206
+ }
207
+ },
208
+
187
209
  "contentCategory": {
188
210
  "anyOf": [{ "type": "boolean" }, { "$ref": "#/definitions/expression" }]
189
211
  },
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.39.1"
8
+ "packageVersion": "7.40.6"
9
9
  }
10
10
  ]
11
11
  }
@@ -1,6 +1,22 @@
1
1
  import { ErrorObject } from 'ajv';
2
2
  import { SchemaObject } from 'ajv';
3
3
 
4
+ /**
5
+ * Returns the normalized metadata property `aria.naming`.
6
+ *
7
+ * - Returns `allowed` if this element allows naming.
8
+ * - Returns `prohibited` if this element does not allow naming.
9
+ * - If the element doesn't have metadata `allowed` is returned.
10
+ *
11
+ * If the element contains an explicit `role` the role is used to determine
12
+ * whenever the element allows naming or not. Otherwise it uses metadata to
13
+ * determine.
14
+ *
15
+ * @public
16
+ * @param element - Element to get `aria.naming` from.
17
+ */
18
+ export declare function ariaNaming(element: HtmlElement): "allowed" | "prohibited";
19
+
4
20
  /**
5
21
  * DOM Attribute.
6
22
  *
@@ -1346,6 +1362,35 @@ export declare interface Message {
1346
1362
  context?: any;
1347
1363
  }
1348
1364
 
1365
+ /**
1366
+ * Element ARIA metadata.
1367
+ *
1368
+ * @public
1369
+ * @since 8.11.0
1370
+ */
1371
+ export declare interface MetaAria {
1372
+ /**
1373
+ * Implicit ARIA role.
1374
+ *
1375
+ * Can be set either to a string (element unconditionally has given role) or a
1376
+ * callback (role depends on the context the element is used in).
1377
+ *
1378
+ * @since 8.11.0
1379
+ */
1380
+ implicitRole?: string | MetaImplicitRoleCallback;
1381
+ /**
1382
+ * If set to `"prohibited"` this element may not specify an accessible name
1383
+ * with `aria-label` or `aria-labelledby`. Defaults to `"allowed"` if unset.
1384
+ *
1385
+ * Note: if the element overrides the `role` (i.e. the `role` attribute is set to
1386
+ * something other than the implicit role) naming may or may not be allowed
1387
+ * depending on the given role instead.
1388
+ *
1389
+ * @since 8.11.0
1390
+ */
1391
+ naming?: "allowed" | "prohibited" | ((node: HtmlElementLike) => "allowed" | "prohibited");
1392
+ }
1393
+
1349
1394
  /**
1350
1395
  * @public
1351
1396
  */
@@ -1428,7 +1473,10 @@ export declare interface MetaData {
1428
1473
  /** Mark element as a form-associated element */
1429
1474
  formAssociated?: Partial<FormAssociated>;
1430
1475
  labelable?: boolean | PropertyExpression;
1476
+ /** @deprecated use {@link MetaAria.implicitRole} instead */
1431
1477
  implicitRole?: MetaImplicitRoleCallback;
1478
+ /** WAI-ARIA attributes */
1479
+ aria?: MetaAria;
1432
1480
  deprecatedAttributes?: string[];
1433
1481
  requiredAttributes?: string[];
1434
1482
  attributes?: PermittedAttribute;
@@ -1480,7 +1528,10 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1480
1528
  tagName: string;
1481
1529
  focusable: boolean | MetaFocusableCallback;
1482
1530
  formAssociated?: FormAssociated;
1531
+ /** @deprecated Use {@link MetaAria.implicitRole} instead */
1483
1532
  implicitRole: MetaImplicitRoleCallback;
1533
+ /** WAI-ARIA attributes */
1534
+ aria: NormalizedMetaAria;
1484
1535
  attributes: Record<string, MetaAttribute>;
1485
1536
  textContent?: TextContent;
1486
1537
  }
@@ -1497,7 +1548,7 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1497
1548
  export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1498
1549
 
1499
1550
  /**
1500
- * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1551
+ * Callback for the `implicitRole` property of `MetaAria`. It takes a node and
1501
1552
  * returns the implicit ARIA role, if any.
1502
1553
  *
1503
1554
  * @public
@@ -1602,6 +1653,32 @@ export declare enum NodeType {
1602
1653
  DOCUMENT_NODE = 9
1603
1654
  }
1604
1655
 
1656
+ /**
1657
+ * Element ARIA metadata.
1658
+ *
1659
+ * @public
1660
+ * @since 8.11.0
1661
+ */
1662
+ export declare interface NormalizedMetaAria {
1663
+ /**
1664
+ *
1665
+ * Normalized version of {@link MetaAria.implicitRole}. Always a callback
1666
+ * returning the role.
1667
+ *
1668
+ * @since 8.11.0
1669
+ * @returns string with role or null if no corresponding role.
1670
+ */
1671
+ implicitRole(node: HtmlElementLike): string | null;
1672
+ /**
1673
+ *
1674
+ * Normalized version of {@link MetaAria.naming}. Always a callback
1675
+ * returning `"allowed"` or `"prohibited"`.
1676
+ *
1677
+ * @since 8.11.0
1678
+ */
1679
+ naming(node: HtmlElementLike): "allowed" | "prohibited";
1680
+ }
1681
+
1605
1682
  /* Excluded from this release type: ParseBeginEvent */
1606
1683
 
1607
1684
  /* Excluded from this release type: ParseEndEvent */
@@ -1,6 +1,22 @@
1
1
  import { ErrorObject } from 'ajv';
2
2
  import { SchemaObject } from 'ajv';
3
3
 
4
+ /**
5
+ * Returns the normalized metadata property `aria.naming`.
6
+ *
7
+ * - Returns `allowed` if this element allows naming.
8
+ * - Returns `prohibited` if this element does not allow naming.
9
+ * - If the element doesn't have metadata `allowed` is returned.
10
+ *
11
+ * If the element contains an explicit `role` the role is used to determine
12
+ * whenever the element allows naming or not. Otherwise it uses metadata to
13
+ * determine.
14
+ *
15
+ * @public
16
+ * @param element - Element to get `aria.naming` from.
17
+ */
18
+ export declare function ariaNaming(element: HtmlElement): "allowed" | "prohibited";
19
+
4
20
  /**
5
21
  * DOM Attribute.
6
22
  *
@@ -1571,6 +1587,35 @@ export declare interface Message {
1571
1587
  context?: any;
1572
1588
  }
1573
1589
 
1590
+ /**
1591
+ * Element ARIA metadata.
1592
+ *
1593
+ * @public
1594
+ * @since 8.11.0
1595
+ */
1596
+ export declare interface MetaAria {
1597
+ /**
1598
+ * Implicit ARIA role.
1599
+ *
1600
+ * Can be set either to a string (element unconditionally has given role) or a
1601
+ * callback (role depends on the context the element is used in).
1602
+ *
1603
+ * @since 8.11.0
1604
+ */
1605
+ implicitRole?: string | MetaImplicitRoleCallback;
1606
+ /**
1607
+ * If set to `"prohibited"` this element may not specify an accessible name
1608
+ * with `aria-label` or `aria-labelledby`. Defaults to `"allowed"` if unset.
1609
+ *
1610
+ * Note: if the element overrides the `role` (i.e. the `role` attribute is set to
1611
+ * something other than the implicit role) naming may or may not be allowed
1612
+ * depending on the given role instead.
1613
+ *
1614
+ * @since 8.11.0
1615
+ */
1616
+ naming?: "allowed" | "prohibited" | ((node: HtmlElementLike) => "allowed" | "prohibited");
1617
+ }
1618
+
1574
1619
  /**
1575
1620
  * @public
1576
1621
  */
@@ -1653,7 +1698,10 @@ export declare interface MetaData {
1653
1698
  /** Mark element as a form-associated element */
1654
1699
  formAssociated?: Partial<FormAssociated>;
1655
1700
  labelable?: boolean | PropertyExpression;
1701
+ /** @deprecated use {@link MetaAria.implicitRole} instead */
1656
1702
  implicitRole?: MetaImplicitRoleCallback;
1703
+ /** WAI-ARIA attributes */
1704
+ aria?: MetaAria;
1657
1705
  deprecatedAttributes?: string[];
1658
1706
  requiredAttributes?: string[];
1659
1707
  attributes?: PermittedAttribute;
@@ -1705,7 +1753,10 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1705
1753
  tagName: string;
1706
1754
  focusable: boolean | MetaFocusableCallback;
1707
1755
  formAssociated?: FormAssociated;
1756
+ /** @deprecated Use {@link MetaAria.implicitRole} instead */
1708
1757
  implicitRole: MetaImplicitRoleCallback;
1758
+ /** WAI-ARIA attributes */
1759
+ aria: NormalizedMetaAria;
1709
1760
  attributes: Record<string, MetaAttribute>;
1710
1761
  textContent?: TextContent;
1711
1762
  }
@@ -1722,7 +1773,7 @@ export declare interface MetaElement extends Omit<MetaData, "deprecatedAttribute
1722
1773
  export declare type MetaFocusableCallback = (node: HtmlElementLike) => boolean;
1723
1774
 
1724
1775
  /**
1725
- * Callback for the `implicitRole` property of `MetaData`. It takes a node and
1776
+ * Callback for the `implicitRole` property of `MetaAria`. It takes a node and
1726
1777
  * returns the implicit ARIA role, if any.
1727
1778
  *
1728
1779
  * @public
@@ -1852,6 +1903,32 @@ export declare enum NodeType {
1852
1903
  DOCUMENT_NODE = 9
1853
1904
  }
1854
1905
 
1906
+ /**
1907
+ * Element ARIA metadata.
1908
+ *
1909
+ * @public
1910
+ * @since 8.11.0
1911
+ */
1912
+ export declare interface NormalizedMetaAria {
1913
+ /**
1914
+ *
1915
+ * Normalized version of {@link MetaAria.implicitRole}. Always a callback
1916
+ * returning the role.
1917
+ *
1918
+ * @since 8.11.0
1919
+ * @returns string with role or null if no corresponding role.
1920
+ */
1921
+ implicitRole(node: HtmlElementLike): string | null;
1922
+ /**
1923
+ *
1924
+ * Normalized version of {@link MetaAria.naming}. Always a callback
1925
+ * returning `"allowed"` or `"prohibited"`.
1926
+ *
1927
+ * @since 8.11.0
1928
+ */
1929
+ naming(node: HtmlElementLike): "allowed" | "prohibited";
1930
+ }
1931
+
1855
1932
  /* Excluded from this release type: ParseBeginEvent */
1856
1933
 
1857
1934
  /* Excluded from this release type: ParseEndEvent */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "html-validate",
3
- "version": "8.9.1",
3
+ "version": "8.11.0",
4
4
  "description": "Offline html5 validator",
5
5
  "keywords": [
6
6
  "html",
@@ -89,10 +89,9 @@
89
89
  "tests/vitest"
90
90
  ],
91
91
  "scripts": {
92
- "prebuild": "run-s codegen prebuild:*",
92
+ "prebuild": "run-s codegen && tsc",
93
93
  "build": "run-s build:cjs build:esm build:script",
94
94
  "postbuild": "bash scripts/pkg",
95
- "prebuild:tsc": "tsc",
96
95
  "build:cjs": "rollup --config rollup.cjs.config.mjs",
97
96
  "build:esm": "rollup --config rollup.esm.config.mjs",
98
97
  "build:script": "node build.mjs",
@@ -107,7 +106,7 @@
107
106
  "htmlvalidate": "node ./bin/html-validate.js",
108
107
  "prepack": "npm run build && release-prepack --bundle package.json",
109
108
  "postpack": "release-postpack package.json",
110
- "prepare": "husky install && npm run codegen",
109
+ "prepare": "husky && npm run codegen",
111
110
  "prettier:check": "prettier --check .",
112
111
  "prettier:write": "prettier --write .",
113
112
  "start": "node docs/server.js",
@@ -169,6 +168,7 @@
169
168
  "!src/vitest/vitest.ts",
170
169
  "!src/utils/compatibility-check.browser.ts",
171
170
  "!src/utils/compatibility-check.nodejs.ts",
171
+ "!**/*.d.ts",
172
172
  "!**/__fixtures__/**"
173
173
  ],
174
174
  "moduleNameMapper": {
@@ -194,22 +194,22 @@
194
194
  "ajv": "^8.0.0",
195
195
  "deepmerge": "4.3.1",
196
196
  "glob": "^10.0.0",
197
- "ignore": "5.3.0",
197
+ "ignore": "5.3.1",
198
198
  "kleur": "^4.1.0",
199
199
  "minimist": "^1.2.0",
200
200
  "prompts": "^2.0.0",
201
201
  "semver": "^7.0.0"
202
202
  },
203
203
  "devDependencies": {
204
- "@html-validate/commitlint-config": "3.0.28",
205
- "@html-validate/eslint-config": "5.12.6",
206
- "@html-validate/eslint-config-jest": "5.12.6",
207
- "@html-validate/eslint-config-typescript": "5.12.6",
208
- "@html-validate/eslint-config-typescript-typeinfo": "5.12.6",
209
- "@html-validate/jest-config": "3.7.7",
210
- "@html-validate/prettier-config": "2.4.10",
211
- "@html-validate/release-scripts": "6.1.0",
212
- "@microsoft/api-extractor": "7.39.1",
204
+ "@html-validate/commitlint-config": "3.0.30",
205
+ "@html-validate/eslint-config": "5.13.2",
206
+ "@html-validate/eslint-config-jest": "5.13.2",
207
+ "@html-validate/eslint-config-typescript": "5.13.1",
208
+ "@html-validate/eslint-config-typescript-typeinfo": "5.13.1",
209
+ "@html-validate/jest-config": "3.9.0",
210
+ "@html-validate/prettier-config": "2.4.12",
211
+ "@html-validate/release-scripts": "6.2.0",
212
+ "@microsoft/api-extractor": "7.40.6",
213
213
  "@rollup/plugin-commonjs": "25.0.7",
214
214
  "@rollup/plugin-json": "6.1.0",
215
215
  "@rollup/plugin-node-resolve": "15.2.3",
@@ -217,28 +217,30 @@
217
217
  "@rollup/plugin-virtual": "3.0.2",
218
218
  "@types/babar": "0.2.4",
219
219
  "@types/babel__code-frame": "7.0.6",
220
- "@types/jest": "29.5.11",
220
+ "@types/jest": "29.5.12",
221
221
  "@types/minimist": "1.2.5",
222
- "@types/node": "16.18.70",
222
+ "@types/node": "16.18.83",
223
223
  "@types/prompts": "2.4.9",
224
- "@types/semver": "7.5.6",
224
+ "@types/semver": "7.5.8",
225
225
  "@types/stream-buffers": "3.0.7",
226
226
  "babar": "0.2.3",
227
- "husky": "8.0.3",
227
+ "husky": "9.0.11",
228
228
  "is-ci": "3.0.1",
229
229
  "jest": "29.7.0",
230
230
  "jest-diff": "29.7.0",
231
231
  "jest-environment-jsdom": "29.7.0",
232
232
  "jest-snapshot": "29.7.0",
233
- "marked": "11.1.1",
234
- "memfs": "4.6.0",
233
+ "jsdom": "20.0.3",
234
+ "marked": "12.0.0",
235
+ "memfs": "4.7.7",
235
236
  "npm-pkg-lint": "2.1.0",
236
- "npm-run-all": "4.1.5",
237
- "rollup": "4.9.4",
238
- "rollup-plugin-esbuild": "6.1.0",
237
+ "npm-run-all2": "6.1.2",
238
+ "rollup": "4.12.0",
239
+ "rollup-plugin-esbuild": "6.1.1",
239
240
  "stream-buffers": "3.0.2",
240
- "ts-jest": "29.1.1",
241
- "typescript": "5.3.3"
241
+ "ts-jest": "29.1.2",
242
+ "typescript": "5.3.3",
243
+ "vite": "4.5.2"
242
244
  },
243
245
  "peerDependencies": {
244
246
  "jest": "^27.1 || ^28.1.3 || ^29.0.3",
@@ -275,7 +277,7 @@
275
277
  "semver"
276
278
  ],
277
279
  "overrides": {
278
- "marked": "11.1.1"
280
+ "marked": "12.0.0"
279
281
  },
280
282
  "renovate": {
281
283
  "extends": [