(t *testing.T)
| 334 | } |
| 335 | |
| 336 | func 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 |
| 341 | formatter: default |
| 342 | rules: |
| 343 | - header-min-length |
| 344 | severity: |
| 345 | default: error |
| 346 | settings: |
| 347 | header-min-length: |
| 348 | argument: 10 |
| 349 | disable-default-ignores: true |
| 350 | ignores: |
| 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 | |
| 375 | func TestConfig_Parse_NonExistentFile(t *testing.T) { |
| 376 | _, err := config.Parse("/nonexistent/path/commitlint.yaml") |
nothing calls this directly
no test coverage detected