Add test to ensure all project version numbers match.

This commit is contained in:
David Anson 2025-11-25 14:48:55 -08:00
parent 9b116ae889
commit b4df555e7c
2 changed files with 36 additions and 4 deletions

View file

@ -979,7 +979,7 @@ All of which return an object like:
{ "lineNumber": 3, { "lineNumber": 3,
"ruleNames": [ "MD010", "no-hard-tabs" ], "ruleNames": [ "MD010", "no-hard-tabs" ],
"ruleDescription": "Hard tabs", "ruleDescription": "Hard tabs",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md010.md", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md010.md",
"errorDetail": "Column: 17", "errorDetail": "Column: 17",
"errorContext": null, "errorContext": null,
"errorRange": [ 17, 1 ], "errorRange": [ 17, 1 ],
@ -988,7 +988,7 @@ All of which return an object like:
{ "lineNumber": 1, { "lineNumber": 1,
"ruleNames": [ "MD018", "no-missing-space-atx" ], "ruleNames": [ "MD018", "no-missing-space-atx" ],
"ruleDescription": "No space after hash on atx style heading", "ruleDescription": "No space after hash on atx style heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md018.md",
"errorDetail": null, "errorDetail": null,
"errorContext": "#bad.md", "errorContext": "#bad.md",
"errorRange": [ 1, 2 ], "errorRange": [ 1, 2 ],
@ -997,7 +997,7 @@ All of which return an object like:
{ "lineNumber": 3, { "lineNumber": 3,
"ruleNames": [ "MD018", "no-missing-space-atx" ], "ruleNames": [ "MD018", "no-missing-space-atx" ],
"ruleDescription": "No space after hash on atx style heading", "ruleDescription": "No space after hash on atx style heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md018.md", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md018.md",
"errorDetail": null, "errorDetail": null,
"errorContext": "#This file fails\tsome rules.", "errorContext": "#This file fails\tsome rules.",
"errorRange": [ 1, 2 ], "errorRange": [ 1, 2 ],
@ -1006,7 +1006,7 @@ All of which return an object like:
{ "lineNumber": 1, { "lineNumber": 1,
"ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ], "ruleNames": [ "MD041", "first-line-heading", "first-line-h1" ],
"ruleDescription": "First line in a file should be a top-level heading", "ruleDescription": "First line in a file should be a top-level heading",
"ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.0.0/doc/md041.md", "ruleInformation": "https://github.com/DavidAnson/markdownlint/blob/v0.39.0/doc/md041.md",
"errorDetail": null, "errorDetail": null,
"errorContext": "#bad.md", "errorContext": "#bad.md",
"errorRange": null, "errorRange": null,

View file

@ -1587,3 +1587,35 @@ test("constants", (t) => {
// @ts-ignore // @ts-ignore
t.is(constants.version, packageJson.version); t.is(constants.version, packageJson.version);
}); });
test("version numbers match", async(t) => {
t.plan(441);
const files = [
// See previous test
// "./package.json",
"./CHANGELOG.md",
"./README.md",
"./helpers/README.md",
"./lib/configuration-strict.d.ts",
// See previous test
// "./lib/constants.mjs",
"./schema/.markdownlint.jsonc",
"./schema/.markdownlint.yaml",
"./schema/markdownlint-config-schema.json",
"./schema/markdownlint-config-schema-strict.json"
];
const contents = await Promise.all(files.map((file) => fs.promises.readFile(file, "utf8")));
for (const content of contents) {
// eslint-disable-next-line init-declarations
let match;
const githubProjectOrFileRe = /(?:DavidAnson\/markdownlint|markdownlint\/blob)\/v(\d+\.\d+\.\d+)/gu;
while ((match = githubProjectOrFileRe.exec(content)) !== null) {
t.is(match[1], packageJson.version);
}
const firstChangelogRe = /## (\d+\.\d+\.\d+)/u;
match = firstChangelogRe.exec(content);
if (match) {
t.is(match[1], packageJson.version);
}
}
});