3
3
/* eslint-env qunit */
4
4
/* globals markdownlintCli2, FsVirtual */
5
5
6
- const oneViolation = "# Title\n\nText \n" ;
7
- const twoViolations = "# Title\n\nText\t\n" ;
8
- const noViolationsIgnoringTabs = "# Title\n\n\tText\n" ;
9
- const configNoHardTabs = "{\n\"no-hard-tabs\": false\n}" ;
6
+ const md009 = "# Title\n\nText \n" ;
7
+ const md010 = "# Title\n\n\tText\n" ;
8
+ const md009md010 = "# Title\n\nText\t\n" ;
9
+ const md047 = "# Title\n\nText" ;
10
+ const configNoMd010 = "{\n\"no-hard-tabs\": false\n}" ;
11
+ const configNoMd047 = "{\n\"single-trailing-newline\": false\n}" ;
10
12
11
13
const files = [
12
- [ "/file.md" , twoViolations ] ,
13
- [ "/dir1/file.md" , twoViolations ] ,
14
- [ "/dir1/.markdownlint.json" , configNoHardTabs ] ,
15
- [ "/dir2/file.md" , twoViolations ] ,
16
- [ "/dir2/.markdownlint-cli2.jsonc" , `{\n"config":${ configNoHardTabs } \n}` ] ,
17
- [ "/dir3/file.md" , twoViolations ] ,
14
+ [ "/file.md" , md009md010 ] ,
15
+ [ "/file-two.md" , md047 ] ,
16
+ [ "/package.json" , `{\n"markdownlint-cli2": {\n"config": ${ configNoMd047 } ,\n"customRules": [],\n"markdownItPlugins": []\n}\n}` ] ,
17
+ [ "/dir1/file.md" , md009md010 ] ,
18
+ [ "/dir1/.markdownlint.json" , configNoMd010 ] ,
19
+ [ "/dir2/file.md" , md009md010 ] ,
20
+ [ "/dir2/.markdownlint-cli2.jsonc" , `{\n"config":${ configNoMd010 } \n}` ] ,
21
+ [ "/dir3/file.md" , md009md010 ] ,
18
22
[ "/dir3/.markdownlint.json" , "{\n\"extends\": \"./extended.json\"\n}" ] ,
19
- [ "/dir3/extended.json" , configNoHardTabs ] ,
20
- [ "/dir4/file.md" , oneViolation ]
23
+ [ "/dir3/extended.json" , configNoMd010 ] ,
24
+ [ "/dir4/file.md" , md009 ] ,
25
+ [ "/dir5/file.md" , md009md010 ] ,
26
+ [ "/dir5/.markdownlint-cli2.yaml" , `config:\n extends: ./extended.json\n` ] ,
27
+ [ "/dir5/extended.json" , configNoMd010 ] ,
28
+ [ "/dir6/skip.md" , md009md010 ] ,
29
+ [ "/dir6/.markdownlint-cli2.jsonc" , `{\n"ignores":["skip.md"]\n}` ]
21
30
] ;
22
31
23
32
const outputFormatterLengthIs = ( assert , length ) => ( options ) => {
@@ -43,7 +52,7 @@ QUnit.test("unsaved", (assert) => {
43
52
"fs" : new FsVirtual ( files ) ,
44
53
"argv" : [ ] ,
45
54
"nonFileContents" : {
46
- "untitled-1" : twoViolations
55
+ "untitled-1" : md009md010
47
56
} ,
48
57
"optionsOverride" : {
49
58
"outputFormatters" : [ [ outputFormatterLengthIs ( assert , 2 ) ] ]
@@ -82,7 +91,7 @@ QUnit.test("file, no configuration, edits", (assert) => {
82
91
"fs" : new FsVirtual ( files ) ,
83
92
"argv" : [ ":/file.md" ] ,
84
93
"fileContents" : {
85
- "/file.md" : oneViolation
94
+ "/file.md" : md009
86
95
} ,
87
96
"optionsOverride" : {
88
97
"outputFormatters" : [ [ outputFormatterLengthIs ( assert , 1 ) ] ]
@@ -107,7 +116,7 @@ QUnit.test("file, .markdownlint.json, edits", (assert) => {
107
116
"fs" : new FsVirtual ( files ) ,
108
117
"argv" : [ ":/dir1/file.md" ] ,
109
118
"fileContents" : {
110
- "/dir1/file.md" : noViolationsIgnoringTabs
119
+ "/dir1/file.md" : md010
111
120
} ,
112
121
"optionsOverride" : {
113
122
"outputFormatters" : [ [ outputFormatterLengthIs ( assert , 0 ) ] ]
@@ -170,7 +179,7 @@ QUnit.test("workspace", (assert) => {
170
179
"fs" : new FsVirtual ( files ) ,
171
180
"argv" : [ "**/*.md" ] ,
172
181
"optionsOverride" : {
173
- "outputFormatters" : [ [ outputFormatterLengthIs ( assert , 6 ) ] ]
182
+ "outputFormatters" : [ [ outputFormatterLengthIs ( assert , 7 ) ] ]
174
183
}
175
184
} ) ;
176
185
} ) ;
0 commit comments