aboutsummaryrefslogtreecommitdiffhomepage
path: root/hugolib
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <[email protected]>2023-07-28 12:04:03 +0200
committerBjørn Erik Pedersen <[email protected]>2023-07-28 15:14:23 +0200
commit1c97095ac01d7fa9a3e879fa69f7b550c200b567 (patch)
tree09e3239fcf740c329e209cc1d40a4311e721881b /hugolib
parentb3cb6788b2634a89ae774895f345f082020b52d8 (diff)
downloadhugo-1c97095ac01d7fa9a3e879fa69f7b550c200b567.tar.gz
hugo-1c97095ac01d7fa9a3e879fa69f7b550c200b567.zip
Warn about unknown kinds in disableKinds
See #11256
Diffstat (limited to 'hugolib')
-rw-r--r--hugolib/config_test.go27
-rw-r--r--hugolib/integrationtest_builder.go23
2 files changed, 48 insertions, 2 deletions
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index a39d57781..9a1d3bcbf 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -1611,3 +1611,30 @@ List.
b.AssertDestinationExists("categories/index.html", false)
}
+
+func TestDisableKindsUnknown(t *testing.T) {
+ t.Parallel()
+
+ files := `
+-- hugo.toml --
+disableKinds = ['foo', 'home']
+-- layouts/_default/list.html --
+List.
+
+
+
+`
+ b := NewIntegrationTestBuilder(
+ IntegrationTestConfig{
+ T: t,
+ TxtarString: files,
+ LogLevel: logg.LevelWarn,
+ BuildCfg: BuildCfg{SkipRender: true},
+ },
+ ).Init()
+
+ fmt.Println("LOG:", b.LogString())
+
+ b.AssertLogContains("WARN Unknown kind \"foo\" in disableKinds\n")
+
+}
diff --git a/hugolib/integrationtest_builder.go b/hugolib/integrationtest_builder.go
index ada01b6ee..6a5cd1ce3 100644
--- a/hugolib/integrationtest_builder.go
+++ b/hugolib/integrationtest_builder.go
@@ -228,6 +228,14 @@ func (s *IntegrationTestBuilder) BuildE() (*IntegrationTestBuilder, error) {
return s, err
}
+func (s *IntegrationTestBuilder) Init() *IntegrationTestBuilder {
+ if err := s.initBuilder(); err != nil {
+ s.Fatalf("Failed to init builder: %s", err)
+ }
+ return s
+
+}
+
type IntegrationTestDebugConfig struct {
Out io.Writer
@@ -356,12 +364,23 @@ func (s *IntegrationTestBuilder) initBuilder() error {
flags.Set("workingDir", s.Cfg.WorkingDir)
}
+ w := &s.logBuff
+
+ logger := loggers.New(
+ loggers.Options{
+ Stdout: w,
+ Stderr: w,
+ Level: s.Cfg.LogLevel,
+ Distinct: true,
+ },
+ )
+
res, err := allconfig.LoadConfig(
allconfig.ConfigSourceDescriptor{
Flags: flags,
ConfigDir: configDir,
Fs: afs,
- Logger: loggers.NewDefault(),
+ Logger: logger,
Environ: s.Cfg.Environ,
},
)
@@ -375,7 +394,7 @@ func (s *IntegrationTestBuilder) initBuilder() error {
s.Assert(err, qt.IsNil)
- depsCfg := deps.DepsCfg{Configs: res, Fs: fs, LogLevel: s.Cfg.LogLevel, LogOut: &s.logBuff}
+ depsCfg := deps.DepsCfg{Configs: res, Fs: fs, LogLevel: logger.Level(), LogOut: logger.Out()}
sites, err := NewHugoSites(depsCfg)
if err != nil {
initErr = err