@@ -283,6 +283,18 @@ var _ = Describe("Load", func() {
283283 unexported: "unexported",
284284 },
285285 }),
286+ Entry("with an unknown option in the config file", &testOptionsTableInput{
287+ configFile: []byte(`unknown_option="foo"`),
288+ flagSet: func() *pflag.FlagSet { return testOptionsFlagSet },
289+ expectedErr: fmt.Errorf("error unmarshalling config: 1 error(s) decoding:\n\n* '' has invalid keys: unknown_option"),
290+ // Viper will unmarshal before returning the error, so this is the default output
291+ expectedOutput: &TestOptions{
292+ StringOption: "default",
293+ Sub: TestOptionSubStruct{
294+ StringSliceOption: []string{"a", "b"},
295+ },
296+ },
297+ }),
286298 )
287299 })
288300})