This commit is contained in:
David Anson 2025-09-03 23:25:56 -07:00
parent 5db10cc29f
commit 5d61d39d55
6 changed files with 112 additions and 3 deletions

View file

@ -1392,6 +1392,29 @@ test("getVersion", (t) => {
t.is(actual, expected, "Version string not correct.");
});
const matcherRe = /^(?<source>[^:]+):\s*(?<line>\d+)(?::(?<column>\d+))?:?\s(?<rule>\S+)\s(?<description>.+)$/;
test("problemMatcher", async(t) => {
t.plan(2);
const content = "# Heading\nText `code ` text ";
const options = {
"strings": {
"relative/path/file name.md": content
}
};
const results = await lintPromise(options);
const getMatches = (input) => input.split("\n").map((line) => matcherRe.exec(line)?.groups);
t.snapshot(getMatches(results.toString()));
// eslint-disable-next-line camelcase
const cli_0_45_0__cli2_0_18_1 =
`relative/path/file name.md:1:3 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "# Heading"]
relative/path/file name.md:1 MD022/blanks-around-headings Headings should be surrounded by blank lines [Expected: 1; Actual: 0; Below] [Context: "# Heading"]
relative/path/file name.md:2:18 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]
relative/path/file name.md:2:11 MD038/no-space-in-code Spaces inside code span elements [Context: "\`code \`"]
relative/path/file name.md:2:18 MD047/single-trailing-newline Files should end with a single newline character`;
t.snapshot(getMatches(cli_0_45_0__cli2_0_18_1));
});
test("constants", (t) => {
t.plan(2);
// @ts-ignore