diff --git a/test/formatter-template/.markdownlint-cli2.jsonc b/test/formatter-template/.markdownlint-cli2.jsonc new file mode 100644 index 0000000..ed2849c --- /dev/null +++ b/test/formatter-template/.markdownlint-cli2.jsonc @@ -0,0 +1,14 @@ +{ + "outputFormatters": [ + [ "../../formatter-template", { "template": "${invalid}" } ], + [ "../../formatter-template", { "template": "${fileName}" } ], + [ "../../formatter-template", { "template": "${fileName}${fileName}${fileName}" } ], + [ "../../formatter-template", { "template": "${fileName:text{text}text}" } ], + [ "../../formatter-template", { "template": "${fileName:text{text}" } ], + [ "../../formatter-template", { "template": "${fileName:text}text}" } ], + [ "../../formatter-template", { "template": "${fileName:text${invalid}text}" } ], + [ "../../formatter-template", { "template": "${fileName:text${fileName}text}" } ], + [ "../../formatter-template", { "template": "${fileName:${fileName}}" } ], + [ "../../formatter-template", { "template": "${fileName:${fileName:${fileName}}}" } ] + ] +} diff --git a/test/formatter-template/simple.md b/test/formatter-template/simple.md new file mode 100644 index 0000000..d9b3ffe --- /dev/null +++ b/test/formatter-template/simple.md @@ -0,0 +1 @@ +# Heading \ No newline at end of file diff --git a/test/markdownlint-cli2-test-cases.js b/test/markdownlint-cli2-test-cases.js index 5cafa9c..11fdfad 100644 --- a/test/markdownlint-cli2-test-cases.js +++ b/test/markdownlint-cli2-test-cases.js @@ -960,6 +960,13 @@ const testCases = ({ } }); + testCase({ + "name": "formatter-template", + "args": [ "*.md" ], + "exitCode": 1, + "usesRequire": true + }); + testCase({ "name": "nested-files", "args": [ "**/*.md" ], diff --git a/test/markdownlint-cli2-test.js b/test/markdownlint-cli2-test.js index b08503c..43c3f4b 100644 --- a/test/markdownlint-cli2-test.js +++ b/test/markdownlint-cli2-test.js @@ -111,7 +111,7 @@ test("validateMarkdownlintConfigSchema", async (t) => { }); test("validateMarkdownlintCli2ConfigSchema", async (t) => { - t.plan(91); + t.plan(92); // Validate schema // @ts-ignore diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.md b/test/snapshots/markdownlint-cli2-test-exec.js.md index deb37bd..9981bbf 100644 --- a/test/snapshots/markdownlint-cli2-test-exec.js.md +++ b/test/snapshots/markdownlint-cli2-test-exec.js.md @@ -5890,6 +5890,32 @@ Generated by [AVA](https://avajs.dev). Summary: 15 error(s)`, } +## formatter-template (exec) + +> Snapshot 1 + + { + exitCode: 1, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: `${invalid}␊ + simple.md␊ + simple.mdsimple.mdsimple.md␊ + text{text}text␊ + text{text␊ + texttext}␊ + text${invalid}text␊ + textsimple.mdtext␊ + simple.md␊ + ${fileName}`, + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + Finding: *.md␊ + Linting: 1 file(s)␊ + Summary: 1 error(s)`, + } + ## nested-files (exec) > Snapshot 1 diff --git a/test/snapshots/markdownlint-cli2-test-exec.js.snap b/test/snapshots/markdownlint-cli2-test-exec.js.snap index 8fd8469..3c13475 100644 Binary files a/test/snapshots/markdownlint-cli2-test-exec.js.snap and b/test/snapshots/markdownlint-cli2-test-exec.js.snap differ diff --git a/test/snapshots/markdownlint-cli2-test-main.js.md b/test/snapshots/markdownlint-cli2-test-main.js.md index 2b3b0bc..2262b32 100644 --- a/test/snapshots/markdownlint-cli2-test-main.js.md +++ b/test/snapshots/markdownlint-cli2-test-main.js.md @@ -5078,6 +5078,34 @@ Generated by [AVA](https://avajs.dev). `, } +## formatter-template (main) + +> Snapshot 1 + + { + exitCode: 1, + formatterCodeQuality: '', + formatterJson: '', + formatterJunit: '', + formatterSarif: '', + stderr: `${invalid}␊ + simple.md␊ + simple.mdsimple.mdsimple.md␊ + text{text}text␊ + text{text␊ + texttext}␊ + text${invalid}text␊ + textsimple.mdtext␊ + simple.md␊ + ${fileName}␊ + `, + stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊ + Finding: *.md␊ + Linting: 1 file(s)␊ + Summary: 1 error(s)␊ + `, + } + ## nested-files (main) > Snapshot 1 diff --git a/test/snapshots/markdownlint-cli2-test-main.js.snap b/test/snapshots/markdownlint-cli2-test-main.js.snap index a0735ec..798533a 100644 Binary files a/test/snapshots/markdownlint-cli2-test-main.js.snap and b/test/snapshots/markdownlint-cli2-test-main.js.snap differ