Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidAnson committed Dec 2, 2023
1 parent 94f45ef commit ff0282b
Show file tree
Hide file tree
Showing 7 changed files with 252 additions and 18 deletions.
38 changes: 33 additions & 5 deletions test/markdownlint-cli2-test-cases.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,8 @@ const testCases = ({
testCase({
"name": "markdownlint-cli2-jsonc-mismatch",
"args": [ "viewme.md" ],
"exitCode": 2
"exitCode": 2,
"stderrRe": /Unexpected token/u
});

testCase({
Expand All @@ -406,6 +407,35 @@ const testCases = ({
"exitCode": 1
});

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

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

testCase({
"name": "markdownlint-cli2-jsonc-mismatch-config",
"args": [ "--config", "../markdownlint-cli2-jsonc-mismatch/.markdownlint-cli2.jsonc", "viewme.md" ],
"exitCode": 2,
"stderrRe": /Unexpected token/u,
"cwd": "no-config",
});

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

testCase({
"name": "markdownlint-cli2-jsonc",
"args": [ "**/*.md" ],
Expand Down Expand Up @@ -496,8 +526,7 @@ const testCases = ({
"configs/.markdownlint-cli2.jsonc",
"viewme.md"
],
"exitCode": 0,
"cwd": "config-option-extends"
"exitCode": 0
});

testCase({
Expand Down Expand Up @@ -1034,8 +1063,7 @@ const testCases = ({
testCase({
"name": "nested-directories",
"args": [ "**", "!a", "a/b", "#a/b/c", "a/b/c/d" ],
"exitCode": 1,
"cwd": "nested-directories"
"exitCode": 1
});

testCase({
Expand Down
82 changes: 73 additions & 9 deletions test/snapshots/markdownlint-cli2-test-exec.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -1134,21 +1134,85 @@ Generated by [AVA](https://avajs.dev).
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-json-mismatch-config (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-config (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-config (exec)

> Snapshot 1
{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

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

> Snapshot 1
{
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-exec.js.snap
Binary file not shown.
75 changes: 73 additions & 2 deletions test/snapshots/markdownlint-cli2-test-fs.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -888,14 +888,85 @@ Generated by [AVA](https://avajs.dev).
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-json-mismatch-config (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-config (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-config (fs)

> Snapshot 1

{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

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

> Snapshot 1

{
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-fs.js.snap
Binary file not shown.
75 changes: 73 additions & 2 deletions test/snapshots/markdownlint-cli2-test-main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -972,14 +972,85 @@ Generated by [AVA](https://avajs.dev).
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-json-mismatch-config (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-config (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-config (main)

> Snapshot 1

{
exitCode: 2,
formatterCodeQuality: '',
formatterJson: '',
formatterJunit: '',
formatterSarif: '',
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
`,
}

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

> Snapshot 1

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

0 comments on commit ff0282b

Please sign in to comment.