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

Function TestConfig_Parse_OldVersionKey

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

Source from the content-addressed store, hash-verified

240}
241
242func TestConfig_Parse_OldVersionKey(t *testing.T) {
243 tmpDir := t.TempDir()
244 confPath := filepath.Join(tmpDir, "commitlint.yaml")
245
246 // Uses the old "version:" key for backward compatibility
247 confContent := `version: v0.9.0
248formatter: default
249rules:
250 - header-min-length
251severity:
252 default: error
253settings:
254 header-min-length:
255 argument: 10
256`
257 err := os.WriteFile(confPath, []byte(confContent), 0o644)
258 if err != nil {
259 t.Fatalf("failed to write config file: %v", err)
260 }
261
262 conf, err := config.Parse(confPath)
263 if err != nil {
264 t.Fatalf("unexpected error parsing old 'version' key: %v", err)
265 }
266
267 if conf.MinVersion != "v0.9.0" {
268 t.Errorf("expected MinVersion 'v0.9.0', got %q", conf.MinVersion)
269 }
270}
271
272func TestConfig_Parse_WithIgnores(t *testing.T) {
273 tmpDir := t.TempDir()

Callers

nothing calls this directly

Calls 1

ParseFunction · 0.92

Tested by

no test coverage detected