Skip to content

Commit

Permalink
Fix remark-lint tests (#150)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
TylerJang27 authored Feb 8, 2023
1 parent 2875452 commit 9131f96
Show file tree
Hide file tree
Showing 6 changed files with 48 additions and 41 deletions.
2 changes: 1 addition & 1 deletion linters/remark-lint/plugin.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ lint:
success_codes: [0]
in_place: true
cache_results: true
- name: check
- name: lint
output: sarif
run: remark ${target} --frail --output --report=vfile-reporter-json
success_codes: [0, 1]
Expand Down
11 changes: 9 additions & 2 deletions linters/remark-lint/remark_lint.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
import { linterCheckTest, linterFmtTest } from "tests";
import path from "path";
import { customLinterCheckTest, linterFmtTest } from "tests";
import { skipOS, TEST_DATA } from "tests/utils";

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

linterCheckTest({ linterName: "remark-lint" });
// TODO(Tyler): Fix custom parsers sometimes breaking on Mac
customLinterCheckTest({
linterName: "remark-lint",
args: path.join(TEST_DATA, "basic.in.md"),
skipTestIf: skipOS(["darwin"]),
});
12 changes: 6 additions & 6 deletions linters/remark-lint/test_data/basic.in.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
* this is a list item
indented with tabs
* this is a list item
indented with tabs

* this is a list item
indented with spaces

Code:

this code block is indented by one tab
this code block is indented by one tab

And:

this code block is indented by two tabs
this code block is indented by two tabs

And:

+ this is an example list item
indented with tabs
+ this is an example list item
indented with tabs

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

exports[`Testing linter remark-lint test basic 1`] = `
exports[`Testing linter remark-lint test CUSTOM 1`] = `
Object {
"issues": Array [
Object {
"bucket": "remark-lint",
"code": "no-tabs",
"column": "5",
"code": "list-item-indent",
"column": "4",
"file": "test_data/basic.in.md",
"issueClass": "ISSUE_CLASS_EXISTING",
"level": "LEVEL_HIGH",
"line": "13",
"line": "1",
"linter": "remark-lint",
"message": "Use spaces instead of tabs",
"targetType": "markdown",
},
Object {
"bucket": "remark-lint",
"code": "no-tabs",
"column": "6",
"file": "test_data/basic.in.md",
"level": "LEVEL_HIGH",
"line": "17",
"linter": "remark-lint",
"message": "Use spaces instead of tabs",
"message": "Incorrect list-item indent: add 1 space",
"targetType": "markdown",
},
],
"lintActions": Array [
Object {
"bucket": "remark-lint",
"code": "no-tabs",
"column": "5",
"file": "test_data/basic.in.md",
"level": "LEVEL_HIGH",
"line": "18",
"command": "fmt",
"fileGroupName": "markdown",
"linter": "remark-lint",
"message": "Use spaces instead of tabs",
"targetType": "markdown",
"paths": Array [
"test_data/basic.in.md",
],
"verb": "TRUNK_VERB_FMT",
},
],
"lintActions": Array [
Object {
"command": "check",
"command": "lint",
"fileGroupName": "markdown",
"linter": "remark-lint",
"paths": Array [
Expand All @@ -48,16 +36,27 @@ Object {
"verb": "TRUNK_VERB_CHECK",
},
Object {
"command": "format",
"command": "lint",
"fileGroupName": "markdown",
"linter": "remark-lint",
"paths": Array [
"test_data/basic.in.md",
],
"verb": "TRUNK_VERB_FMT",
"upstream": true,
"verb": "TRUNK_VERB_CHECK",
},
],
"taskFailures": Array [],
"unformattedFiles": Array [],
"unformattedFiles": Array [
Object {
"column": "1",
"file": "test_data/basic.in.md",
"issueClass": "ISSUE_CLASS_UNFORMATTED",
"level": "LEVEL_HIGH",
"line": "1",
"linter": "remark-lint",
"message": "Incorrect formatting, autoformat by running 'trunk fmt'",
},
],
}
`;
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ And:

And:

+ this is an example list item
indented with tabs
+ this is an example list item
indented with tabs

+ this is an example list item
indented with spaces
Expand Down
1 change: 1 addition & 0 deletions linters/renovate/renovate.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { customLinterCheckTest } from "tests";
import { skipOS } from "tests/utils";

// TODO(Tyler): Fix custom parsers sometimes breaking on Mac
// python missing on mac
customLinterCheckTest({
linterName: "renovate",
Expand Down

0 comments on commit 9131f96

Please sign in to comment.