Skip to content

Commit

Permalink
Add pattern-matching test cases for formatter-template.
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Nov 9, 2024
1 parent f4462c6 commit 70a3324
Show file tree
Hide file tree
Showing 8 changed files with 77 additions and 1 deletion.
14 changes: 14 additions & 0 deletions test/formatter-template/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -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}}}" } ]
]
}
1 change: 1 addition & 0 deletions test/formatter-template/simple.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Heading
7 changes: 7 additions & 0 deletions test/markdownlint-cli2-test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -960,6 +960,13 @@ const testCases = ({
}
});

testCase({
"name": "formatter-template",
"args": [ "*.md" ],
"exitCode": 1,
"usesRequire": true
});

testCase({
"name": "nested-files",
"args": [ "**/*.md" ],
Expand Down
2 changes: 1 addition & 1 deletion test/markdownlint-cli2-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ test("validateMarkdownlintConfigSchema", async (t) => {
});

test("validateMarkdownlintCli2ConfigSchema", async (t) => {
t.plan(91);
t.plan(92);

// Validate schema
// @ts-ignore
Expand Down
26 changes: 26 additions & 0 deletions test/snapshots/markdownlint-cli2-test-exec.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-exec.js.snap
Binary file not shown.
28 changes: 28 additions & 0 deletions test/snapshots/markdownlint-cli2-test-main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-main.js.snap
Binary file not shown.

0 comments on commit 70a3324

Please sign in to comment.