MCPcopy Index your code
hub / github.com/conventionalcommit/commitlint / TestLint_ParserErrorAlwaysError

Function TestLint_ParserErrorAlwaysError

test/lint_test.go:234–259  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

232}
233
234func TestLint_ParserErrorAlwaysError(t *testing.T) {
235 conf := config.NewDefault()
236 // Even with all rules set to warn, parser errors should be SeverityError
237 conf.Severity.Default = lint.SeverityWarn
238 rules, err := config.GetEnabledRules(conf)
239 if err != nil {
240 t.Fatal(err)
241 }
242 linter, err := lint.New(conf, rules)
243 if err != nil {
244 t.Fatal(err)
245 }
246
247 result, err := linter.ParseAndLint("")
248 if err != nil {
249 t.Fatal(err)
250 }
251 if len(result.Issues()) == 0 {
252 t.Fatal("expected parser issue for empty msg")
253 }
254 for _, iss := range result.Issues() {
255 if iss.RuleName() == "parser" && iss.Severity() != lint.SeverityError {
256 t.Errorf("parser errors should be SeverityError, got %q", iss.Severity())
257 }
258 }
259}
260
261// ---------------------------------------------------------------------------
262// Body edge cases

Callers

nothing calls this directly

Calls 7

NewDefaultFunction · 0.92
GetEnabledRulesFunction · 0.92
NewFunction · 0.92
ParseAndLintMethod · 0.80
IssuesMethod · 0.80
RuleNameMethod · 0.80
SeverityMethod · 0.80

Tested by

no test coverage detected