setupTestConfig sets viper to read the .taskmd.yaml from the test directory.
(t *testing.T, dir string)
| 491 | |
| 492 | // setupTestConfig sets viper to read the .taskmd.yaml from the test directory. |
| 493 | func 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 | } |
no test coverage detected