Skip to content

Commit 9131f96

Browse files
authoredFeb 8, 2023
Fix remark-lint tests (#150)
The last commit broke some of the tests. Namely, the no-tabs plugin was removed, the subcommands were renamed, and I believe the original file was saved with spaces.
1 parent 2875452 commit 9131f96

6 files changed

+48
-41
lines changed
 

‎linters/remark-lint/plugin.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ lint:
2828
success_codes: [0]
2929
in_place: true
3030
cache_results: true
31-
- name: check
31+
- name: lint
3232
output: sarif
3333
run: remark ${target} --frail --output --report=vfile-reporter-json
3434
success_codes: [0, 1]
+9-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
1-
import { linterCheckTest, linterFmtTest } from "tests";
1+
import path from "path";
2+
import { customLinterCheckTest, linterFmtTest } from "tests";
3+
import { skipOS, TEST_DATA } from "tests/utils";
24

35
linterFmtTest({ linterName: "remark-lint" });
46

5-
linterCheckTest({ linterName: "remark-lint" });
7+
// TODO(Tyler): Fix custom parsers sometimes breaking on Mac
8+
customLinterCheckTest({
9+
linterName: "remark-lint",
10+
args: path.join(TEST_DATA, "basic.in.md"),
11+
skipTestIf: skipOS(["darwin"]),
12+
});
+6-6
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
1-
* this is a list item
2-
indented with tabs
1+
* this is a list item
2+
indented with tabs
33

44
* this is a list item
55
indented with spaces
66

77
Code:
88

9-
this code block is indented by one tab
9+
this code block is indented by one tab
1010

1111
And:
1212

13-
this code block is indented by two tabs
13+
this code block is indented by two tabs
1414

1515
And:
1616

17-
+ this is an example list item
18-
indented with tabs
17+
+ this is an example list item
18+
indented with tabs
1919

2020
+ this is an example list item
2121
indented with spaces
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,33 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`Testing linter remark-lint test basic 1`] = `
3+
exports[`Testing linter remark-lint test CUSTOM 1`] = `
44
Object {
55
"issues": Array [
66
Object {
77
"bucket": "remark-lint",
8-
"code": "no-tabs",
9-
"column": "5",
8+
"code": "list-item-indent",
9+
"column": "4",
1010
"file": "test_data/basic.in.md",
11+
"issueClass": "ISSUE_CLASS_EXISTING",
1112
"level": "LEVEL_HIGH",
12-
"line": "13",
13+
"line": "1",
1314
"linter": "remark-lint",
14-
"message": "Use spaces instead of tabs",
15-
"targetType": "markdown",
16-
},
17-
Object {
18-
"bucket": "remark-lint",
19-
"code": "no-tabs",
20-
"column": "6",
21-
"file": "test_data/basic.in.md",
22-
"level": "LEVEL_HIGH",
23-
"line": "17",
24-
"linter": "remark-lint",
25-
"message": "Use spaces instead of tabs",
15+
"message": "Incorrect list-item indent: add 1 space",
2616
"targetType": "markdown",
2717
},
18+
],
19+
"lintActions": Array [
2820
Object {
29-
"bucket": "remark-lint",
30-
"code": "no-tabs",
31-
"column": "5",
32-
"file": "test_data/basic.in.md",
33-
"level": "LEVEL_HIGH",
34-
"line": "18",
21+
"command": "fmt",
22+
"fileGroupName": "markdown",
3523
"linter": "remark-lint",
36-
"message": "Use spaces instead of tabs",
37-
"targetType": "markdown",
24+
"paths": Array [
25+
"test_data/basic.in.md",
26+
],
27+
"verb": "TRUNK_VERB_FMT",
3828
},
39-
],
40-
"lintActions": Array [
4129
Object {
42-
"command": "check",
30+
"command": "lint",
4331
"fileGroupName": "markdown",
4432
"linter": "remark-lint",
4533
"paths": Array [
@@ -48,16 +36,27 @@ Object {
4836
"verb": "TRUNK_VERB_CHECK",
4937
},
5038
Object {
51-
"command": "format",
39+
"command": "lint",
5240
"fileGroupName": "markdown",
5341
"linter": "remark-lint",
5442
"paths": Array [
5543
"test_data/basic.in.md",
5644
],
57-
"verb": "TRUNK_VERB_FMT",
45+
"upstream": true,
46+
"verb": "TRUNK_VERB_CHECK",
5847
},
5948
],
6049
"taskFailures": Array [],
61-
"unformattedFiles": Array [],
50+
"unformattedFiles": Array [
51+
Object {
52+
"column": "1",
53+
"file": "test_data/basic.in.md",
54+
"issueClass": "ISSUE_CLASS_UNFORMATTED",
55+
"level": "LEVEL_HIGH",
56+
"line": "1",
57+
"linter": "remark-lint",
58+
"message": "Incorrect formatting, autoformat by running 'trunk fmt'",
59+
},
60+
],
6261
}
6362
`;

‎linters/remark-lint/test_data/remark_lint_v11.0.0_basic.fmt.shot

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ And:
1717

1818
And:
1919

20-
+ this is an example list item
21-
indented with tabs
20+
+ this is an example list item
21+
indented with tabs
2222

2323
+ this is an example list item
2424
indented with spaces

‎linters/renovate/renovate.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { customLinterCheckTest } from "tests";
22
import { skipOS } from "tests/utils";
33

4+
// TODO(Tyler): Fix custom parsers sometimes breaking on Mac
45
// python missing on mac
56
customLinterCheckTest({
67
linterName: "renovate",

0 commit comments

Comments
 (0)
Please sign in to comment.