Skip to content

Commit 70a3324

Browse files
committed
Add pattern-matching test cases for formatter-template.
1 parent f4462c6 commit 70a3324

8 files changed

+77
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"outputFormatters": [
3+
[ "../../formatter-template", { "template": "${invalid}" } ],
4+
[ "../../formatter-template", { "template": "${fileName}" } ],
5+
[ "../../formatter-template", { "template": "${fileName}${fileName}${fileName}" } ],
6+
[ "../../formatter-template", { "template": "${fileName:text{text}text}" } ],
7+
[ "../../formatter-template", { "template": "${fileName:text{text}" } ],
8+
[ "../../formatter-template", { "template": "${fileName:text}text}" } ],
9+
[ "../../formatter-template", { "template": "${fileName:text${invalid}text}" } ],
10+
[ "../../formatter-template", { "template": "${fileName:text${fileName}text}" } ],
11+
[ "../../formatter-template", { "template": "${fileName:${fileName}}" } ],
12+
[ "../../formatter-template", { "template": "${fileName:${fileName:${fileName}}}" } ]
13+
]
14+
}

test/formatter-template/simple.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Heading

test/markdownlint-cli2-test-cases.js

+7
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,13 @@ const testCases = ({
960960
}
961961
});
962962

963+
testCase({
964+
"name": "formatter-template",
965+
"args": [ "*.md" ],
966+
"exitCode": 1,
967+
"usesRequire": true
968+
});
969+
963970
testCase({
964971
"name": "nested-files",
965972
"args": [ "**/*.md" ],

test/markdownlint-cli2-test.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ test("validateMarkdownlintConfigSchema", async (t) => {
111111
});
112112

113113
test("validateMarkdownlintCli2ConfigSchema", async (t) => {
114-
t.plan(91);
114+
t.plan(92);
115115

116116
// Validate schema
117117
// @ts-ignore

test/snapshots/markdownlint-cli2-test-exec.js.md

+26
Original file line numberDiff line numberDiff line change
@@ -5890,6 +5890,32 @@ Generated by [AVA](https://avajs.dev).
58905890
Summary: 15 error(s)`,
58915891
}
58925892

5893+
## formatter-template (exec)
5894+
5895+
> Snapshot 1
5896+
5897+
{
5898+
exitCode: 1,
5899+
formatterCodeQuality: '',
5900+
formatterJson: '',
5901+
formatterJunit: '',
5902+
formatterSarif: '',
5903+
stderr: `${invalid}␊
5904+
simple.md␊
5905+
simple.mdsimple.mdsimple.md␊
5906+
text{text}text␊
5907+
text{text␊
5908+
texttext}␊
5909+
text${invalid}text␊
5910+
textsimple.mdtext␊
5911+
simple.md␊
5912+
${fileName}`,
5913+
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
5914+
Finding: *.md␊
5915+
Linting: 1 file(s)␊
5916+
Summary: 1 error(s)`,
5917+
}
5918+
58935919
## nested-files (exec)
58945920

58955921
> Snapshot 1
Binary file not shown.

test/snapshots/markdownlint-cli2-test-main.js.md

+28
Original file line numberDiff line numberDiff line change
@@ -5078,6 +5078,34 @@ Generated by [AVA](https://avajs.dev).
50785078
`,
50795079
}
50805080

5081+
## formatter-template (main)
5082+
5083+
> Snapshot 1
5084+
5085+
{
5086+
exitCode: 1,
5087+
formatterCodeQuality: '',
5088+
formatterJson: '',
5089+
formatterJunit: '',
5090+
formatterSarif: '',
5091+
stderr: `${invalid}␊
5092+
simple.md␊
5093+
simple.mdsimple.mdsimple.md␊
5094+
text{text}text␊
5095+
text{text␊
5096+
texttext}␊
5097+
text${invalid}text␊
5098+
textsimple.mdtext␊
5099+
simple.md␊
5100+
${fileName}␊
5101+
`,
5102+
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
5103+
Finding: *.md␊
5104+
Linting: 1 file(s)␊
5105+
Summary: 1 error(s)␊
5106+
`,
5107+
}
5108+
50815109
## nested-files (main)
50825110

50835111
> Snapshot 1
109 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)