wip
Some checks are pending
Checkers / linkcheck (push) Waiting to run
Checkers / spellcheck (push) Waiting to run
CI / build (20, macos-latest) (push) Waiting to run
CI / build (20, ubuntu-latest) (push) Waiting to run
CI / build (20, windows-latest) (push) Waiting to run
CI / build (22, macos-latest) (push) Waiting to run
CI / build (22, ubuntu-latest) (push) Waiting to run
CI / build (22, windows-latest) (push) Waiting to run
CI / build (24, macos-latest) (push) Waiting to run
CI / build (24, ubuntu-latest) (push) Waiting to run
CI / build (24, windows-latest) (push) Waiting to run
CI / pnpm (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
TestRepos / build (latest, ubuntu-latest) (push) Waiting to run
UpdateTestRepos / update (push) Waiting to run

This commit is contained in:
David Anson 2025-09-15 22:27:23 -07:00
parent 56cde85f72
commit 17002d3983

View file

@ -170,16 +170,18 @@ function normalizeLintResults(results) {
* Gets a Configuration value test implementation. * Gets a Configuration value test implementation.
* *
* @param {Configuration} config Configuration object. * @param {Configuration} config Configuration object.
* @param {string[]} files List of files.
* @param {NormalizedLintResults} expected Expected result. * @param {NormalizedLintResults} expected Expected result.
* @returns {ImplementationFn} Test implementation. * @returns {ImplementationFn} Test implementation.
*/ */
function getConfigTestImplementation(config, files, expected) { function getConfigTestImplementation(config, expected) {
return async(t) => { return async(t) => {
t.plan(1); t.plan(1);
const options = { const options = {
config, config,
files, "files": [
"./test/atx_heading_spacing.md",
"./test/first_heading_bad_atx.md"
],
"noInlineConfig": true "noInlineConfig": true
}; };
const actual = await lintPromise(options); const actual = await lintPromise(options);
@ -187,10 +189,6 @@ function getConfigTestImplementation(config, files, expected) {
}; };
} }
const configTestFiles = [
"./test/atx_heading_spacing.md",
"./test/first_heading_bad_atx.md"
];
const configTestExpected = { const configTestExpected = {
"./test/atx_heading_spacing.md": [], "./test/atx_heading_spacing.md": [],
"./test/first_heading_bad_atx.md": [] "./test/first_heading_bad_atx.md": []
@ -241,53 +239,45 @@ const configTestExpected13511 = {
test("defaultUnset", getConfigTestImplementation( test("defaultUnset", getConfigTestImplementation(
{}, {},
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
test("defaultTrue", getConfigTestImplementation( test("defaultTrue", getConfigTestImplementation(
{ "default": true }, { "default": true },
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
test("defaultFalse", getConfigTestImplementation( test("defaultFalse", getConfigTestImplementation(
{ "default": false }, { "default": false },
configTestFiles,
configTestExpected configTestExpected
)); ));
test("defaultTruthy", getConfigTestImplementation( test("defaultTruthy", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
{ "default": 1 }, { "default": 1 },
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
test("defaultFalsy", getConfigTestImplementation( test("defaultFalsy", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
{ "default": 0 }, { "default": 0 },
configTestFiles,
configTestExpected configTestExpected
)); ));
test("defaultError", getConfigTestImplementation( test("defaultError", getConfigTestImplementation(
{ "default": "error" }, { "default": "error" },
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
test("defaultWarning", getConfigTestImplementation( test("defaultWarning", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
{ "default": "warning" }, { "default": "warning" },
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
test("defaultOff", getConfigTestImplementation( test("defaultOff", getConfigTestImplementation(
// @ts-ignore // @ts-ignore
{ "default": "off" }, { "default": "off" },
configTestFiles,
configTestExpected13511 configTestExpected13511
)); ));
@ -298,7 +288,6 @@ test("disableRules", getConfigTestImplementation(
"first-line-h1": false, "first-line-h1": false,
"extra": false "extra": false
}, },
configTestFiles,
configTestExpected1 configTestExpected1
)); ));
@ -311,7 +300,6 @@ test("disableRulesFalsy", getConfigTestImplementation(
"first-line-h1": 0, "first-line-h1": 0,
"extra": 0 "extra": 0
}, },
configTestFiles,
configTestExpected1 configTestExpected1
)); ));
@ -322,7 +310,6 @@ test("enableRules", getConfigTestImplementation(
"no-multiple-space-atx": true, "no-multiple-space-atx": true,
"extra": true "extra": true
}, },
configTestFiles,
configTestExpected3511 configTestExpected3511
)); ));
@ -333,7 +320,6 @@ test("enableRulesMixedCase", getConfigTestImplementation(
"nO-mUlTiPlE-sPaCe-AtX": true, "nO-mUlTiPlE-sPaCe-AtX": true,
"ExTrA": true "ExTrA": true
}, },
configTestFiles,
configTestExpected3511 configTestExpected3511
)); ));
@ -346,7 +332,6 @@ test("enableRulesTruthy", getConfigTestImplementation(
"no-multiple-space-atx": 1, "no-multiple-space-atx": 1,
"extra": 1 "extra": 1
}, },
configTestFiles,
configTestExpected3511 configTestExpected3511
)); ));
@ -357,7 +342,6 @@ test("enableRulesString", getConfigTestImplementation(
"no-multiple-space-atx": "error", "no-multiple-space-atx": "error",
"extra": "error" "extra": "error"
}, },
configTestFiles,
configTestExpected3511 configTestExpected3511
)); ));
@ -369,7 +353,6 @@ test("enableRulesEmptyObject", getConfigTestImplementation(
"no-multiple-space-atx": {}, "no-multiple-space-atx": {},
"extra": {} "extra": {}
}, },
configTestFiles,
configTestExpected3511 configTestExpected3511
)); ));
@ -379,7 +362,6 @@ test("disableTag", getConfigTestImplementation(
"spaces": false, "spaces": false,
"extra": false "extra": false
}, },
configTestFiles,
configTestExpected11 configTestExpected11
)); ));
@ -390,7 +372,6 @@ test("disableTagFalsy", getConfigTestImplementation(
"spaces": 0, "spaces": 0,
"extra": 0 "extra": 0
}, },
configTestFiles,
configTestExpected11 configTestExpected11
)); ));
@ -400,7 +381,6 @@ test("enableTag", getConfigTestImplementation(
"spaces": true, "spaces": true,
"extra": true "extra": true
}, },
configTestFiles,
configTestExpected135 configTestExpected135
)); ));
@ -410,7 +390,6 @@ test("enableTagMixedCase", getConfigTestImplementation(
"SpAcEs": true, "SpAcEs": true,
"ExTrA": true "ExTrA": true
}, },
configTestFiles,
configTestExpected135 configTestExpected135
)); ));
@ -421,7 +400,6 @@ test("enableTagTruthy", getConfigTestImplementation(
"spaces": 1, "spaces": 1,
"extra": 1 "extra": 1
}, },
configTestFiles,
configTestExpected135 configTestExpected135
)); ));
@ -431,7 +409,6 @@ test("enableTagString", getConfigTestImplementation(
"spaces": "error", "spaces": "error",
"extra": "error" "extra": "error"
}, },
configTestFiles,
configTestExpected135 configTestExpected135
)); ));