MCPcopy Create free account
hub / github.com/driangle/taskmd / setupTestConfig

Function setupTestConfig

apps/cli/internal/cli/context_test.go:493–505  ·  view source on GitHub ↗

setupTestConfig sets viper to read the .taskmd.yaml from the test directory.

(t *testing.T, dir string)

Source from the content-addressed store, hash-verified

491
492// setupTestConfig sets viper to read the .taskmd.yaml from the test directory.
493func setupTestConfig(t *testing.T, dir string) {
494 t.Helper()
495 configPath := filepath.Join(dir, ".taskmd.yaml")
496 oldConfigFile := cfgFile
497 t.Cleanup(func() {
498 cfgFile = oldConfigFile
499 viper.Reset()
500 })
501 cfgFile = configPath
502 initConfig()
503 // Ensure taskDir still points to tmpDir (config's "dir" is relative to the config file)
504 taskDir = dir
505}

Callers 12

TestContext_TouchesOnlyFunction · 0.85
TestContext_ExplicitOnlyFunction · 0.85
TestContext_BothSourcesFunction · 0.85
TestContext_EmptyTaskFunction · 0.85
TestContext_MissingFilesFunction · 0.85
TestContext_JSONFunction · 0.85
TestContext_YAMLFunction · 0.85
TestContext_IncludeDepsFunction · 0.85
TestContext_MaxFilesFunction · 0.85
TestContext_DependenciesFunction · 0.85

Calls 1

initConfigFunction · 0.85

Tested by

no test coverage detected