-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes #771 for cases of malformed config. `biome fmt` outputs an exit code of 1. For lint, we have to have `success_codes: [0, 1]`, but for format we can just have `success_codes: [0]` so that we better surface this error to users. Also adds a relevant test case.
- Loading branch information
1 parent
887931c
commit 7e2d554
Showing
4 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
import { linterCheckTest, linterFmtTest } from "tests"; | ||
import path from "path"; | ||
import { customLinterCheckTest, linterCheckTest, linterFmtTest } from "tests"; | ||
import { TrunkLintDriver } from "tests/driver"; | ||
import { TEST_DATA } from "tests/utils"; | ||
|
||
linterCheckTest({ linterName: "biome", namedTestPrefixes: ["basic_check"] }); | ||
|
||
linterFmtTest({ linterName: "biome", namedTestPrefixes: ["basic_fmt", "basic_json"] }); | ||
|
||
const preCheck = (driver: TrunkLintDriver) => { | ||
// Write an invalid biome config and verify we surface an error for format. | ||
// NOTE(Tyler): We should handle config errors better for 'lint' too, but the JSON | ||
// output for biome is not stable and they don't support SARIF. | ||
driver.writeFile("biome.json", JSON.stringify({ rules: { "no-foo": "error" } })); | ||
}; | ||
|
||
customLinterCheckTest({ | ||
linterName: "biome", | ||
testName: "error", | ||
args: path.join(TEST_DATA, "basic_check.in.ts"), | ||
preCheck, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter biome test error 1`] = ` | ||
{ | ||
"issues": [], | ||
"lintActions": [ | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [ | ||
{ | ||
"details": StringMatching /\\.\\*\\$/m, | ||
"message": "test_data/basic_check.in.ts", | ||
"name": "biome", | ||
}, | ||
], | ||
"unformattedFiles": [], | ||
} | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Testing linter biome test error 1`] = ` | ||
{ | ||
"issues": [], | ||
"lintActions": [ | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
{ | ||
"command": "lint", | ||
"fileGroupName": "typescript", | ||
"linter": "biome", | ||
"paths": [ | ||
"test_data/basic_check.in.ts", | ||
], | ||
"upstream": true, | ||
"verb": "TRUNK_VERB_CHECK", | ||
}, | ||
], | ||
"taskFailures": [ | ||
{ | ||
"details": StringMatching /\\.\\*\\$/m, | ||
"message": "test_data/basic_check.in.ts", | ||
"name": "biome", | ||
}, | ||
], | ||
"unformattedFiles": [], | ||
} | ||
`; |