mirror of
https://github.com/DavidAnson/markdownlint.git
synced 2025-12-18 15:00:13 +01:00
Add snapshot test for markdownit token params passed to custom rules.
This commit is contained in:
parent
d279c4e424
commit
bdd5cdcafe
4 changed files with 3092 additions and 2 deletions
|
|
@ -57,7 +57,7 @@
|
||||||
"test-cover": "c8 --100 npm test",
|
"test-cover": "c8 --100 npm test",
|
||||||
"test-declaration": "cd example/typescript && tsc --module nodenext && tsc --module commonjs && node type-check.js",
|
"test-declaration": "cd example/typescript && tsc --module nodenext && tsc --module commonjs && node type-check.js",
|
||||||
"test-extra": "ava --timeout=10m test/markdownlint-test-extra-parse.js test/markdownlint-test-extra-type.js",
|
"test-extra": "ava --timeout=10m test/markdownlint-test-extra-parse.js test/markdownlint-test-extra-type.js",
|
||||||
"update-snapshots": "ava --update-snapshots test/markdownlint-test-micromark.mjs test/markdownlint-test-scenarios.js",
|
"update-snapshots": "ava --update-snapshots test/markdownlint-test-custom-rules.js test/markdownlint-test-micromark.mjs test/markdownlint-test-scenarios.js",
|
||||||
"update-snapshots-test-repos": "ava --timeout=10m --update-snapshots test/markdownlint-test-repos-*.js",
|
"update-snapshots-test-repos": "ava --timeout=10m --update-snapshots test/markdownlint-test-repos-*.js",
|
||||||
"upgrade": "npx --yes npm-check-updates --upgrade"
|
"upgrade": "npx --yes npm-check-updates --upgrade"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -622,7 +622,7 @@ test("customRulesParserMicromark", (t) => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("customRulesParamsTokensSameObject", (t) => {
|
test("customRulesMarkdownItParamsTokensSameObject", (t) => {
|
||||||
t.plan(1);
|
t.plan(1);
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
/** @type import("../lib/markdownlint").Options */
|
/** @type import("../lib/markdownlint").Options */
|
||||||
|
|
@ -647,6 +647,29 @@ test("customRulesParamsTokensSameObject", (t) => {
|
||||||
return markdownlint.promises.markdownlint(options).then(() => null);
|
return markdownlint.promises.markdownlint(options).then(() => null);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test("customRulesMarkdownItTokensSnapshot", (t) => {
|
||||||
|
t.plan(1);
|
||||||
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
|
/** @type import("../lib/markdownlint").Options */
|
||||||
|
const options = {
|
||||||
|
"customRules": [
|
||||||
|
{
|
||||||
|
"names": [ "name" ],
|
||||||
|
"description": "description",
|
||||||
|
"tags": [ "tag" ],
|
||||||
|
"parser": "markdownit",
|
||||||
|
"function":
|
||||||
|
(params) => {
|
||||||
|
t.snapshot(params.parsers.markdownit.tokens, "Unexpected tokens");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"files": "./test/every-markdown-syntax.md",
|
||||||
|
"noInlineConfig": true
|
||||||
|
};
|
||||||
|
return markdownlint.promises.markdownlint(options).then(() => null);
|
||||||
|
});
|
||||||
|
|
||||||
test("customRulesDefinitionStatic", (t) => new Promise((resolve) => {
|
test("customRulesDefinitionStatic", (t) => new Promise((resolve) => {
|
||||||
t.plan(2);
|
t.plan(2);
|
||||||
// eslint-disable-next-line jsdoc/valid-types
|
// eslint-disable-next-line jsdoc/valid-types
|
||||||
|
|
|
||||||
3067
test/snapshots/markdownlint-test-custom-rules.js.md
Normal file
3067
test/snapshots/markdownlint-test-custom-rules.js.md
Normal file
File diff suppressed because it is too large
Load diff
BIN
test/snapshots/markdownlint-test-custom-rules.js.snap
Normal file
BIN
test/snapshots/markdownlint-test-custom-rules.js.snap
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue