Skip to content

Commit d60f996

Browse files
committed
Add more code coverage to Web Worker unit tests.
1 parent 200f711 commit d60f996

File tree

1 file changed

+25
-16
lines changed

1 file changed

+25
-16
lines changed

webworker/webworker-test.js

Lines changed: 25 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,30 @@
33
/* eslint-env qunit */
44
/* globals markdownlintCli2, FsVirtual */
55

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}";
1012

1113
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 ],
1822
[ "/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}` ]
2130
];
2231

2332
const outputFormatterLengthIs = (assert, length) => (options) => {
@@ -43,7 +52,7 @@ QUnit.test("unsaved", (assert) => {
4352
"fs": new FsVirtual(files),
4453
"argv": [],
4554
"nonFileContents": {
46-
"untitled-1": twoViolations
55+
"untitled-1": md009md010
4756
},
4857
"optionsOverride": {
4958
"outputFormatters": [ [ outputFormatterLengthIs(assert, 2) ] ]
@@ -82,7 +91,7 @@ QUnit.test("file, no configuration, edits", (assert) => {
8291
"fs": new FsVirtual(files),
8392
"argv": [ ":/file.md" ],
8493
"fileContents": {
85-
"/file.md": oneViolation
94+
"/file.md": md009
8695
},
8796
"optionsOverride": {
8897
"outputFormatters": [ [ outputFormatterLengthIs(assert, 1) ] ]
@@ -107,7 +116,7 @@ QUnit.test("file, .markdownlint.json, edits", (assert) => {
107116
"fs": new FsVirtual(files),
108117
"argv": [ ":/dir1/file.md" ],
109118
"fileContents": {
110-
"/dir1/file.md": noViolationsIgnoringTabs
119+
"/dir1/file.md": md010
111120
},
112121
"optionsOverride": {
113122
"outputFormatters": [ [ outputFormatterLengthIs(assert, 0) ] ]
@@ -170,7 +179,7 @@ QUnit.test("workspace", (assert) => {
170179
"fs": new FsVirtual(files),
171180
"argv": [ "**/*.md" ],
172181
"optionsOverride": {
173-
"outputFormatters": [ [ outputFormatterLengthIs(assert, 6) ] ]
182+
"outputFormatters": [ [ outputFormatterLengthIs(assert, 7) ] ]
174183
}
175184
});
176185
});

0 commit comments

Comments
 (0)