mirror of
https://github.com/gohugoio/hugo.git
synced 2025-09-02 22:52:51 +02:00
Make the "is this a Hugo Module" logic more lenient
Now we only try to load modules via Go if there is one or more modules imported in project config. Fixes #6299
This commit is contained in:
1
hugolib/config.toml
Executable file
1
hugolib/config.toml
Executable file
@@ -0,0 +1 @@
|
||||
workingdir = "/private/var/folders/n6/s_85mm8d31j6yctssnmn_g1r0000gn/T/hugo-no-mod217094359"
|
@@ -541,3 +541,28 @@ title: "My Page"
|
||||
|
||||
b.AssertFileContent("public/mypage/index.html", "Permalink: https://example.org/mypage/")
|
||||
}
|
||||
|
||||
// https://github.com/gohugoio/hugo/issues/6299
|
||||
func TestSiteWithGoModButNoModules(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
c := qt.New(t)
|
||||
// We need to use the OS fs for this.
|
||||
workDir, clean, err := htesting.CreateTempDir(hugofs.Os, "hugo-no-mod")
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
||||
cfg := viper.New()
|
||||
cfg.Set("workingDir", workDir)
|
||||
fs := hugofs.NewFrom(hugofs.Os, cfg)
|
||||
|
||||
defer clean()
|
||||
|
||||
b := newTestSitesBuilder(t)
|
||||
b.Fs = fs
|
||||
|
||||
b.WithWorkingDir(workDir).WithViper(cfg)
|
||||
|
||||
b.WithSourceFile("go.mod", "")
|
||||
b.Build(BuildCfg{})
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user