Skip to content

Commit

Permalink
Add test case for markdownItPlugins referencing packages from a local…
Browse files Browse the repository at this point in the history
… node_modules directory.
  • Loading branch information
DavidAnson committed Oct 3, 2023
1 parent 59d8697 commit 1f765d2
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 7 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ coverage
node_modules
npm-debug.log
!test/customRules/node_modules
!test/markdownItPlugins/module/node_modules
!test/outputFormatters-module/node_modules
webworker/markdownlint-cli2-webworker.js
5 changes: 5 additions & 0 deletions test/markdownItPlugins/module/.markdownlint-cli2.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"markdownItPlugins": [
[ "custom-markdown-it-plugin" ]
]
}
3 changes: 3 additions & 0 deletions test/markdownItPlugins/module/link.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Heading

Text [ link ](https://example.com)

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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(83);
t.plan(84);

// Validate schema
const { addSchema, validate } =
Expand Down
2 changes: 1 addition & 1 deletion test/snapshots/markdownlint-cli2-test-exec.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -3868,7 +3868,7 @@ Generated by [AVA](https://avajs.dev).
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Linting: 5 file(s)␊
Linting: 6 file(s)␊
Summary: 4 error(s)␊
`,
}
Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-exec.js.snap
Binary file not shown.
5 changes: 3 additions & 2 deletions test/snapshots/markdownlint-cli2-test-fs.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2026,6 +2026,7 @@ Generated by [AVA](https://avajs.dev).
formatterSarif: '',
stderr: `file/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
function/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
module/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊
multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊
multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊
Expand All @@ -2034,8 +2035,8 @@ Generated by [AVA](https://avajs.dev).
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Linting: 5 file(s)␊
Summary: 7 error(s)␊
Linting: 6 file(s)␊
Summary: 8 error(s)␊
`,
}

Expand Down
Binary file modified test/snapshots/markdownlint-cli2-test-fs.js.snap
Binary file not shown.
7 changes: 4 additions & 3 deletions test/snapshots/markdownlint-cli2-test-main.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -2714,7 +2714,7 @@ Generated by [AVA](https://avajs.dev).
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Linting: 5 file(s)␊
Linting: 6 file(s)␊
Summary: 4 error(s)␊
`,
}
Expand Down Expand Up @@ -5006,6 +5006,7 @@ Generated by [AVA](https://avajs.dev).
formatterSarif: '',
stderr: `file/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
function/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
module/link.md:3:6 MD039/no-space-in-links Spaces inside link text [Context: "[ link ]"]␊
multiple/emoji.md:3:15 MD044/proper-names Proper names should have the correct capitalization [Expected: SMILE; Actual: smile]␊
multiple/emoji.md:5:13 MD044/proper-names Proper names should have the correct capitalization [Expected: FROWNING; Actual: frowning]␊
multiple/emoji.md:15 MD012/no-multiple-blanks Multiple consecutive blank lines [Expected: 1; Actual: 2]␊
Expand All @@ -5014,8 +5015,8 @@ Generated by [AVA](https://avajs.dev).
`,
stdout: `markdownlint-cli2 vX.Y.Z (markdownlint vX.Y.Z)␊
Finding: **/*.md␊
Linting: 5 file(s)␊
Summary: 7 error(s)␊
Linting: 6 file(s)␊
Summary: 8 error(s)␊
`,
}

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

0 comments on commit 1f765d2

Please sign in to comment.