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

Function TestConfig_Parse_DisableDefaultIgnores

test/config_test.go:336–373  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

334}
335
336func TestConfig_Parse_DisableDefaultIgnores(t *testing.T) {
337 tmpDir := t.TempDir()
338 confPath := filepath.Join(tmpDir, "commitlint.yaml")
339
340 confContent := `min-version: v0.9.0
341formatter: default
342rules:
343 - header-min-length
344severity:
345 default: error
346settings:
347 header-min-length:
348 argument: 10
349disable-default-ignores: true
350ignores:
351 - "^WIP "
352`
353 err := os.WriteFile(confPath, []byte(confContent), 0o644)
354 if err != nil {
355 t.Fatalf("failed to write config file: %v", err)
356 }
357
358 conf, err := config.Parse(confPath)
359 if err != nil {
360 t.Fatalf("unexpected error: %v", err)
361 }
362
363 if !conf.DisableDefaultIgnores {
364 t.Error("expected DisableDefaultIgnores to be true")
365 }
366 if len(conf.IgnorePatterns) != 1 {
367 t.Errorf("expected 1 user ignore pattern, got %d", len(conf.IgnorePatterns))
368 }
369 effective := conf.EffectiveIgnorePatterns()
370 if len(effective) != 1 {
371 t.Errorf("expected 1 effective pattern (defaults disabled), got %d", len(effective))
372 }
373}
374
375func TestConfig_Parse_NonExistentFile(t *testing.T) {
376 _, err := config.Parse("/nonexistent/path/commitlint.yaml")

Callers

nothing calls this directly

Calls 3

ParseFunction · 0.92
ErrorMethod · 0.80

Tested by

no test coverage detected