MCPcopy Create free account
hub / github.com/conventionalcommit/commitlint / TestConfig_Parse_WithIgnores

Function TestConfig_Parse_WithIgnores

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

Source from the content-addressed store, hash-verified

270}
271
272func TestConfig_Parse_WithIgnores(t *testing.T) {
273 tmpDir := t.TempDir()
274 confPath := filepath.Join(tmpDir, "commitlint.yaml")
275
276 confContent := `min-version: v0.9.0
277formatter: default
278rules:
279 - header-min-length
280severity:
281 default: error
282settings:
283 header-min-length:
284 argument: 10
285ignores:
286 - "^WIP "
287 - "^TICKET-\\d+"
288`
289 err := os.WriteFile(confPath, []byte(confContent), 0o644)
290 if err != nil {
291 t.Fatalf("failed to write config file: %v", err)
292 }
293
294 conf, err := config.Parse(confPath)
295 if err != nil {
296 t.Fatalf("unexpected error: %v", err)
297 }
298
299 if len(conf.IgnorePatterns) != 2 {
300 t.Errorf("expected 2 ignore patterns, got %d", len(conf.IgnorePatterns))
301 }
302}
303
304func TestConfig_Parse_WithoutIgnores_UsesDefaults(t *testing.T) {
305 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 1

ParseFunction · 0.92

Tested by

no test coverage detected