Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 1, 2023
1 parent 5e86bf6 commit 94f45ef
Show file tree
Hide file tree
Showing 16 changed files with 327 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
config:
default: false
14 changes: 14 additions & 0 deletions test/markdownlint-cli2-jsonc-mismatch/viewme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Title

> Tagline

# Description

Text text text
Text text text
Text text text

## Summary

Text text text
25 changes: 24 additions & 1 deletion test/markdownlint-cli2-test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,30 @@ const testCases = ({
"usesRequire": true
});

testCase({
"name": "markdownlint-json-mismatch",
"args": [ "viewme.md" ],
"exitCode": 0
});

testCase({
"name": "markdownlint-yaml-mismatch",
"args": [ "viewme.md" ],
"exitCode": 0
});

testCase({
"name": "markdownlint-cli2-jsonc-mismatch",
"args": [ "viewme.md" ],
"exitCode": 2
});

testCase({
"name": "markdownlint-cli2-yaml-mismatch",
"args": [ "viewme.md" ],
"exitCode": 1
});

testCase({
"name": "markdownlint-cli2-jsonc",
"args": [ "**/*.md" ],
Expand Down Expand Up @@ -1187,7 +1211,6 @@ const testCases = ({
"exitCode": 1,
"usesRequire": true
});

};

module.exports = testCases;
2 changes: 2 additions & 0 deletions test/markdownlint-cli2-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ test("validateMarkdownlintConfigSchema", async (t) => {
"**/*.markdownlint.(json|jsonc)",
"!node_modules/**",
"!**/*-copy-*/**",
"!**/*mismatch*/**",
"!**/*invalid*/**",
"!**/invalid*"
],
Expand Down Expand Up @@ -127,6 +128,7 @@ test("validateMarkdownlintCli2ConfigSchema", async (t) => {
"**/*.markdownlint-cli2.(json|jsonc)",
"!node_modules/**",
"!**/*-copy-*/**",
"!**/*mismatch*/**",
"!**/*invalid*/**",
"!**/invalid*",
"!test/customRules/dir/subdir2/.markdownlint-cli2.jsonc"
Expand Down
6 changes: 6 additions & 0 deletions test/markdownlint-cli2-yaml-mismatch/.markdownlint-cli2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"config": {
// Comment
"default": false
}
}
14 changes: 14 additions & 0 deletions test/markdownlint-cli2-yaml-mismatch/viewme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Title

> Tagline

# Description

Text text text
Text text text
Text text text

## Summary

Text text text
1 change: 1 addition & 0 deletions test/markdownlint-json-mismatch/.markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
default: false
14 changes: 14 additions & 0 deletions test/markdownlint-json-mismatch/viewme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Title

> Tagline

# Description

Text text text
Text text text
Text text text

## Summary

Text text text
4 changes: 4 additions & 0 deletions test/markdownlint-yaml-mismatch/.markdownlint.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
// Comment
"default": false
}
14 changes: 14 additions & 0 deletions test/markdownlint-yaml-mismatch/viewme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Title

> Tagline

# Description

Text text text
Text text text
Text text text

## Summary

Text text text
82 changes: 82 additions & 0 deletions test/snapshots/markdownlint-cli2-test-exec.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,88 @@ Generated by [AVA](https://avajs.dev).
`,
}

## markdownlint-json-mismatch (exec)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-yaml-mismatch (exec)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-cli2-jsonc-mismatch (exec)

> Snapshot 1
{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `SyntaxError: Unexpected token c in JSON at position 0␊
at JSON.parse (<anonymous>)␊
at /Users/david/Documents/markdownlint-cli2/markdownlint-cli2.js:43:25␊
at /Users/david/Documents/markdownlint-cli2/markdownlint-cli2.js:321:38␊
at async Promise.all (index 0)␊
at async getBaseOptions (/Users/david/Documents/markdownlint-cli2/markdownlint-cli2.js:440:3)␊
at async main (/Users/david/Documents/markdownlint-cli2/markdownlint-cli2.js:941:5)␊
at async /Users/david/Documents/markdownlint-cli2/markdownlint-cli2.js:1045:26␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

## markdownlint-cli2-yaml-mismatch (exec)

> Snapshot 1
{
exitCode: 1,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `viewme.md:3:10 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]␊
viewme.md:5 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊
viewme.md:6 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "# Description"]␊
viewme.md:12:1 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "## Summary"]␊
viewme.md:14:14 MD047/single-trailing-newline Files should end with a single newline character␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 5 error(s)␊
`,
}

## markdownlint-cli2-jsonc (exec)

> Snapshot 1
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-exec.js.snap
Binary file not shown.
75 changes: 75 additions & 0 deletions test/snapshots/markdownlint-cli2-test-fs.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,81 @@ Generated by [AVA](https://avajs.dev).
`,
}

## markdownlint-json-mismatch (fs)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-yaml-mismatch (fs)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-cli2-jsonc-mismatch (fs)

> Snapshot 1
{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `Unexpected token c in JSON at position 0␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

## markdownlint-cli2-yaml-mismatch (fs)

> Snapshot 1
{
exitCode: 1,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `viewme.md:3:10 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]␊
viewme.md:5 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊
viewme.md:6 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "# Description"]␊
viewme.md:12:1 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "## Summary"]␊
viewme.md:14:14 MD047/single-trailing-newline Files should end with a single newline character␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 5 error(s)␊
`,
}

## markdownlint-cli2-jsonc (fs)

> Snapshot 1
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-fs.js.snap
Binary file not shown.
75 changes: 75 additions & 0 deletions test/snapshots/markdownlint-cli2-test-main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -926,6 +926,81 @@ Generated by [AVA](https://avajs.dev).
`,
}

## markdownlint-json-mismatch (main)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-yaml-mismatch (main)

> Snapshot 1
{
exitCode: 0,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 0 error(s)␊
`,
}

## markdownlint-cli2-jsonc-mismatch (main)

> Snapshot 1
{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `Unexpected token c in JSON at position 0␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

## markdownlint-cli2-yaml-mismatch (main)

> Snapshot 1
{
exitCode: 1,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stderr: `viewme.md:3:10 MD009/no-trailing-spaces Trailing spaces [Expected: 0 or 2; Actual: 1]␊
viewme.md:5 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊
viewme.md:6 MD025/single-title/single-h1 Multiple top-level headings in the same document [Context: "# Description"]␊
viewme.md:12:1 MD019/no-multiple-space-atx Multiple spaces after hash on atx style heading [Context: "## Summary"]␊
viewme.md:14:14 MD047/single-trailing-newline Files should end with a single newline character␊
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: viewme.md␊
Linting: 1 file(s)␊
Summary: 5 error(s)␊
`,
}

## markdownlint-cli2-jsonc (main)

> Snapshot 1
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-main.js.snap
Binary file not shown.

0 comments on commit 94f45ef

Please sign in to comment.