diff --git a/cache/filecache/filecache_integration_test.go b/cache/filecache/filecache_integration_test.go
index d17c4367b..88873c740 100644
--- a/cache/filecache/filecache_integration_test.go
+++ b/cache/filecache/filecache_integration_test.go
@@ -18,7 +18,6 @@ import (
"testing"
"time"
- "github.com/bep/logg"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
@@ -39,9 +38,9 @@ title: "Home"
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t, TxtarString: files, RunGC: true, NeedsOsFS: true},
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithConfig(func(c *hugolib.IntegrationTestConfig) {
+ c.RunGC = true
+ }))
_, err := b.H.BaseFs.ResourcesCache.Stat(filepath.Join("_gen", "images"))
@@ -77,9 +76,9 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t, TxtarString: files, Running: true, RunGC: true, NeedsOsFS: true, LogLevel: logg.LevelInfo},
- ).Build()
+ b := hugolib.TestRunning(t, files, hugolib.TestOptOsFs(), hugolib.TestOptInfo(), hugolib.TestOptWithConfig(func(c *hugolib.IntegrationTestConfig) {
+ c.RunGC = true
+ }))
b.Assert(b.GCCount, qt.Equals, 0)
b.Assert(b.H, qt.IsNotNil)
diff --git a/config/allconfig/allconfig_integration_test.go b/config/allconfig/allconfig_integration_test.go
index 6899cf21c..8bdfe76ac 100644
--- a/config/allconfig/allconfig_integration_test.go
+++ b/config/allconfig/allconfig_integration_test.go
@@ -43,9 +43,7 @@ title: "p1"
Title: {{ .Title }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t, TxtarString: files},
- ).Build()
+ b := hugolib.Test(t, files)
// b.AssertFileContent("public/p1/index.html", "Title: p1")
@@ -81,9 +79,7 @@ baseURL = "https://example.com"
logI18nWarnings = true
logPathWarnings = true
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t, TxtarString: files},
- ).Build()
+ b := hugolib.Test(t, files)
conf := b.H.Configs.Base
diff --git a/hugolib/config_test.go b/hugolib/config_test.go
index 0b3147bc3..ae5efaf30 100644
--- a/hugolib/config_test.go
+++ b/hugolib/config_test.go
@@ -125,12 +125,7 @@ weight = 1
[languages.sv]
weight = 2
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `default language "sv" is disabled`)
@@ -174,13 +169,9 @@ pm31: {{ .Site.Params.pm3.pm31 }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Environ: []string{"HUGO_PARAMS_P2=p2env", "HUGO_PARAMS_PM2_PM21=pm21env", "HUGO_PARAMS_PM3_PM31=pm31env"},
- },
- ).Build()
+ b := Test(t, files, TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.Environ = []string{"HUGO_PARAMS_P2=p2env", "HUGO_PARAMS_PM2_PM21=pm21env", "HUGO_PARAMS_PM3_PM31=pm31env"}
+ }))
b.AssertFileContent("public/index.html", "p1: p1base\np2: p2env\npm21: pm21env\npm22: pm22base\npm31: pm31env")
})
@@ -254,14 +245,9 @@ Home.
for i, v := range environ {
environ[i] = strings.ReplaceAll(v, " ", delim)
}
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Environ: environ,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender(), TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.Environ = environ
+ }))
conf := b.H.Configs.Base
b.Assert(conf.DisableLanguages, qt.DeepEquals, []string{"no", "sv"})
@@ -651,12 +637,7 @@ defaultMarkdownHandler = 'blackfriday'
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "Configured defaultMarkdownHandler \"blackfriday\" not found. Did you mean to use goldmark? Blackfriday was removed in Hugo v0.100.0.")
@@ -692,12 +673,7 @@ themeconfigdirparam: {{ site.Params.themeconfigdirparam }}
files := strings.ReplaceAll(filesTemplate, "hugo.toml", configName)
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html",
@@ -743,13 +719,9 @@ Single.
files = strings.ReplaceAll(files, "WEIGHT_SV", "2")
cfg := config.New()
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BaseCfg: cfg,
- },
- ).BuildE()
+ b, err := TestE(t, files, TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.BaseCfg = cfg
+ }))
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", "Home: en|2|")
@@ -762,13 +734,9 @@ Single.
for range 20 {
cfg := config.New()
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BaseCfg: cfg,
- },
- ).BuildE()
+ b, err := TestE(t, files, TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.BaseCfg = cfg
+ }))
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", "Home: en|2|")
@@ -801,12 +769,7 @@ Home.
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/myindex.html", "Home.")
@@ -836,12 +799,7 @@ ThisIsAParam: {{ site.Params.thisIsAParam }}
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", `
@@ -882,13 +840,7 @@ LanguageCode: {{ eq site.LanguageCode site.Language.LanguageCode }}|{{ site.Lang
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- },
- ).Build()
+ b := Test(t, files, TestOptWarn())
b.Assert(b.H.Log.LoggCount(logg.LevelWarn), qt.Equals, 1)
@@ -936,13 +888,9 @@ func TestConfigHugoWorkingDir(t *testing.T) {
WorkingDir: {{ hugo.WorkingDir }}|
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- WorkingDir: "myworkingdir",
- },
- ).Build()
+ b := Test(t, files, TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.WorkingDir = "myworkingdir"
+ }))
b.AssertFileContent("public/index.html", `
WorkingDir: myworkingdir|
@@ -1009,12 +957,7 @@ Home
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNil)
b.AssertFileContent("public/index.html", `
@@ -1147,12 +1090,7 @@ Foo: {{ site.Params.foo }}|
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "invalid language configuration ")
@@ -1174,12 +1112,7 @@ weight = 1
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `defaultContentLanguage "sv" not found in languages configuration`)
@@ -1339,14 +1272,9 @@ func TestLoadConfigYamlEnvVar(t *testing.T) {
env = defaultEnv
}
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Environ: env,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender(), TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.Environ = env
+ }))
outputs := b.H.Configs.Base.Outputs
if env == nil {
diff --git a/hugolib/content_map_test.go b/hugolib/content_map_test.go
index 2f1f73a2c..6072c4256 100644
--- a/hugolib/content_map_test.go
+++ b/hugolib/content_map_test.go
@@ -210,11 +210,7 @@ Home: {{ .Title }}|
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: c,
- TxtarString: files,
- }).Build()
+ b := Test(c, files)
b.AssertFileContent("public/index.html", "Home: Integration Test|")
}
diff --git a/hugolib/filesystems/basefs_test.go b/hugolib/filesystems/basefs_test.go
index 5bc0393fe..883cf4d28 100644
--- a/hugolib/filesystems/basefs_test.go
+++ b/hugolib/filesystems/basefs_test.go
@@ -296,14 +296,9 @@ F1 text
os.Chdir(wd)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- WorkingDir: tmpDir,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithConfig(func(c *hugolib.IntegrationTestConfig) {
+ c.WorkingDir = tmpDir
+ }))
bfs := b.H.BaseFs
watchFilenames := bfs.WatchFilenames()
@@ -432,13 +427,9 @@ title: "Foo"
---
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- WorkingDir: tempDir,
- TxtarString: files,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWithConfig(func(c *hugolib.IntegrationTestConfig) {
+ c.WorkingDir = tempDir
+ }))
abs1 := filepath.Join(tempDir, "content", "foo.md")
rel, abs2, err := b.H.BaseFs.AbsProjectContentDir("foo.md")
diff --git a/hugolib/frontmatter_test.go b/hugolib/frontmatter_test.go
index 8b8937f49..2f823e929 100644
--- a/hugolib/frontmatter_test.go
+++ b/hugolib/frontmatter_test.go
@@ -31,14 +31,7 @@ Ints: {{ printf "%T" .Params.ints }} {{ range .Params.ints }}Int: {{ fmt.Printf
Mixed: {{ printf "%T" .Params.mixed }} {{ range .Params.mixed }}Mixed: {{ fmt.Printf "%[1]v (%[1]T)" . }}|{{ end }}
Strings: {{ printf "%T" .Params.strings }} {{ range .Params.strings }}Strings: {{ fmt.Printf "%[1]v (%[1]T)" . }}|{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- b.Build()
+ b := Test(t, files)
b.AssertFileContent("public/post/one/index.html", "Ints: []interface {} Int: 1 (uint64)|Int: 2 (uint64)|Int: 3 (uint64)|")
b.AssertFileContent("public/post/one/index.html", "Mixed: []interface {} Mixed: 1 (string)|Mixed: 2 (uint64)|Mixed: 3 (uint64)|")
diff --git a/hugolib/hugo_smoke_test.go b/hugolib/hugo_smoke_test.go
index 2561b160d..284091db6 100644
--- a/hugolib/hugo_smoke_test.go
+++ b/hugolib/hugo_smoke_test.go
@@ -38,13 +38,7 @@ title: Page
Home: {{ .Title }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- // LogLevel: logg.LevelTrace,
- },
- ).Build()
+ b := Test(t, files)
b.Assert(b.H.Log.LoggCount(logg.LevelWarn), qt.Equals, 0)
b.AssertFileContent("public/index.html", `Hello`)
@@ -508,13 +502,7 @@ Content Tag 1.
`
- b := NewIntegrationTestBuilder(IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- // Verbose: true,
- // LogLevel: logg.LevelTrace,
- }).Build()
+ b := Test(t, files, TestOptOsFs())
b.AssertFileContent("public/en/index.html",
"Home: en|home|/en/|Home in English|
Home Content.
\n|HTML",
@@ -751,11 +739,7 @@ The content.
// This is just a test to verify that BenchmarkBaseline is working as intended.
func TestBenchmarkBaseline(t *testing.T) {
- cfg := IntegrationTestConfig{
- T: t,
- TxtarString: benchmarkBaselineFiles(true),
- }
- b := NewIntegrationTestBuilder(cfg).Build()
+ b := Test(t, benchmarkBaselineFiles(true))
b.Assert(len(b.H.Sites), qt.Equals, 4)
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 161)
diff --git a/hugolib/hugolib_integration_test.go b/hugolib/hugolib_integration_test.go
index 3d416c76c..c5570469a 100644
--- a/hugolib/hugolib_integration_test.go
+++ b/hugolib/hugolib_integration_test.go
@@ -58,13 +58,7 @@ tags: ['T1']
{{ range .AllTranslations }}{{ .Title }}-{{ .Lang }} {{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
// Kind home
b.AssertFileContent("public/en/index.html",
@@ -98,14 +92,8 @@ func TestRenderStringBadMarkupOpt(t *testing.T) {
{{ "something" | .RenderString $opts }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- _, err := b.BuildE()
+ b, err := hugolib.TestE(t, files)
+ _ = b
want := `no content renderer found for markup "foo"`
if !strings.Contains(err.Error(), want) {
@@ -136,12 +124,6 @@ title: Films
{{ (site.GetPage "/films").Title }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", "tags\nfiction\nbooks\nFilms")
}
diff --git a/hugolib/page__fragments_test.go b/hugolib/page__fragments_test.go
index 0e4fd1c60..4a6fe356d 100644
--- a/hugolib/page__fragments_test.go
+++ b/hugolib/page__fragments_test.go
@@ -56,12 +56,7 @@ Fragments : {{ $p1.Fragments.Identifiers }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- TxtarString: files,
- T: t,
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/en/p1/index.html", "HTML")
b.AssertFileContent("public/en/p1/index.json", "ToC: \n \n \nFragments : [heading-1-fr]")
@@ -98,12 +93,7 @@ Fragments: {{ .Fragments.Identifiers }}|
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- TxtarString: files,
- T: t,
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/p1/index.html", "Fragments: [heading-p1-1 heading-p2-1 heading-p2-2]|")
b.AssertFileContent("public/p2/index.html", "Fragments: [heading-p2-1 heading-p2-2]|")
diff --git a/hugolib/page_test.go b/hugolib/page_test.go
index 245456b97..1d34df54c 100644
--- a/hugolib/page_test.go
+++ b/hugolib/page_test.go
@@ -378,14 +378,7 @@ allow = ['^python$', '^rst2html.*', '^asciidoctor$']
homePath := fmt.Sprintf("_index.%s", e.ext)
files.WriteString(fmt.Sprintf("-- content/%s --\n%s\n", homePath, homePage))
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files.String(),
- NeedsOsFS: true,
- BaseCfg: cfg,
- },
- ).Build()
+ b := Test(t, files.String(), TestOptOsFs(), TestOptWithConfig(func(c *IntegrationTestConfig) { c.BaseCfg = cfg }))
s := b.H.Sites[0]
@@ -412,13 +405,7 @@ baseURL = "http://example.com/"
-- content/simple.md --
` + simplePageWithSummaryDelimiterAndMarkdownThatCrossesBorder + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
@@ -688,13 +675,7 @@ baseURL = "http://example.com/"
-- content/tocpage.md --
` + pageWithToC + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
@@ -1069,13 +1050,7 @@ baseURL = "http://example.com/"
-- content/simple.md --
` + simplePageRFC3339Date + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
@@ -1109,13 +1084,7 @@ date = ["` + dateHandler + `", "date"]
-- content/section/2012-02-22-slug.md --
` + fmt.Sprintf(pageTemplate, 2, "slug: aslug") + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true, // Needed for fileModTime
- },
- ).Build()
+ b := Test(t, files, TestOptOsFs())
s := b.H.Sites[0]
b.Assert(len(s.RegularPages()), qt.Equals, 2)
@@ -1277,13 +1246,7 @@ post = ":year/:month/:day/:title/"
-- content/` + test.path + ` --
` + test.content + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
s := b.H.Sites[0]
b.Assert(len(s.RegularPages()), qt.Equals, 1)
@@ -1469,13 +1432,7 @@ baseURL = "http://example.com/"
-- content/simple.md --
` + utf8BOM + simplePage + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
@@ -1745,13 +1702,7 @@ title: Scratch Me!
{{< scratch >}}
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNil)
@@ -1824,13 +1775,7 @@ author = "Jo Nesbø"
+++
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html",
"Author page: Ernest Miller Hemingway",
@@ -1894,13 +1839,7 @@ T-SHORT
-- content/page.md --
` + content + `
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/page/index.html",
`
@@ -1932,10 +1871,7 @@ title: "p2"
---
`
- b := NewIntegrationTestBuilder(IntegrationTestConfig{
- T: t,
- TxtarString: files,
- }).Build()
+ b := Test(t, files)
p1 := b.H.Sites[0].RegularPages()[0]
p2 := b.H.Sites[0].RegularPages()[1]
@@ -1957,12 +1893,7 @@ func TestRenderWithoutArgument(t *testing.T) {
{{ .Render }}
`
- b, err := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := TestE(t, files)
b.Assert(err, qt.IsNotNil)
}
diff --git a/hugolib/pagebundler_test.go b/hugolib/pagebundler_test.go
index 0ea695366..ee9808f4b 100644
--- a/hugolib/pagebundler_test.go
+++ b/hugolib/pagebundler_test.go
@@ -332,13 +332,7 @@ headless: true
HEADLESS1: {{ $headless1.Title }}|{{ $headless1.RelPermalink }}|{{ len $headless1.Resources }}|
HEADLESS2: {{ $headless2.Title }}{{ $headless2.RelPermalink }}|{{ len $headless2.Resources }}|
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
HEADLESS1: My Headless Bundle1||1|
diff --git a/hugolib/pagecollections_test.go b/hugolib/pagecollections_test.go
index 31af55260..dc43c986c 100644
--- a/hugolib/pagecollections_test.go
+++ b/hugolib/pagecollections_test.go
@@ -584,13 +584,7 @@ Single.
/README.md: {{ with .GetPage "/README.md" }}{{ .Title }}{{ end }}|
{{ .Content }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html",
`
@@ -649,13 +643,7 @@ title: about1en
NOT FOUND
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `Docs p1: p1`)
b.AssertFileContent("public/en/index.html", `NOT FOUND`)
@@ -713,13 +701,7 @@ title: news1
Sect1 RegularPagesRecursive: {{ range $sect1.RegularPagesRecursive }}{{ .Kind }}:{{ .RelPermalink}}|{{ end }}|End.
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
Sect1 RegularPagesRecursive: page:/docs/sect1/ps1/|page:/docs/sect1/ps2/|page:/docs/sect1/sect1_s2/ps2_1/||End.
@@ -737,11 +719,7 @@ func TestRegularPagesRecursiveHome(t *testing.T) {
RegularPagesRecursive: {{ range .RegularPagesRecursive }}{{ .Kind }}:{{ .RelPermalink}}|{{ end }}|End.
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- }).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `RegularPagesRecursive: page:/p1/|page:/post/p2/||End.`)
}
diff --git a/hugolib/rebuild_test.go b/hugolib/rebuild_test.go
index d61e94a5a..d05ef7538 100644
--- a/hugolib/rebuild_test.go
+++ b/hugolib/rebuild_test.go
@@ -7,7 +7,6 @@ import (
"testing"
"time"
- "github.com/bep/logg"
"github.com/fortytw2/leaktest"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/types"
@@ -986,18 +985,12 @@ Codeblock Include: {{ .Title }}|
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- Verbose: false,
- BuildCfg: BuildCfg{
- testCounters: &buildCounters{},
- },
- LogLevel: logg.LevelWarn,
- },
- ).Build()
+ b := TestRunning(t, files,
+ TestOptWarn(),
+ TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.BuildCfg = BuildCfg{testCounters: &buildCounters{}}
+ }),
+ )
// When running the server, this is done on shutdown.
// Do this here to satisfy the leak detector above.
@@ -1331,18 +1324,11 @@ Content: {{ .Content }}|
testCounters := &buildCounters{}
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- // LogLevel: logg.LevelTrace,
- // Verbose: true,
- BuildCfg: BuildCfg{
- testCounters: testCounters,
- },
- },
- ).Build()
+ b := TestRunning(t, files,
+ TestOptWithConfig(func(c *IntegrationTestConfig) {
+ c.BuildCfg = BuildCfg{testCounters: testCounters}
+ }),
+ )
b.AssertFileContent("public/index.html", ``)
b.AssertFileContent("public/p1/index.html", "")
@@ -1502,15 +1488,9 @@ console.log("Hello");
foo();
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- // LogLevel: logg.LevelTrace,
- NeedsOsFS: true,
- },
- ).Build()
+ b := TestRunning(t, files,
+ TestOptOsFs(),
+ )
b.AssertFileContent("public/index.html", "Home.", "Hello", "Foo")
// Edit the imported file.
@@ -1585,16 +1565,10 @@ Single.
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- // LogLevel: logg.LevelDebug,
- },
- ).Build()
+ b := TestRunning(t, files,
+ TestOptOsFs(),
+ TestOptWithNpmInstall(),
+ )
b.AssertFileContent("public/index.html", "Home.", "")
b.AssertFileContent("public/p1/index.html", "Single.", "/css/main.css")
@@ -1748,14 +1722,9 @@ Home.
runTest := func(transpiler string) {
t.Run(transpiler, func(t *testing.T) {
files := strings.Replace(filesTemplate, "TRANSPILER", transpiler, 1)
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- NeedsOsFS: true,
- },
- ).Build()
+ b := TestRunning(t, files,
+ TestOptOsFs(),
+ )
b.AssertFileContent("public/index.html", "Home.", "background: red")
diff --git a/hugolib/rendershortcodes_test.go b/hugolib/rendershortcodes_test.go
index 9c2966d5b..e952e258f 100644
--- a/hugolib/rendershortcodes_test.go
+++ b/hugolib/rendershortcodes_test.go
@@ -189,13 +189,7 @@ Myshort Original.
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- Running: true,
- },
- ).Build()
+ b := TestRunning(t, files)
b.AssertNoRenderShortcodesArtifacts()
b.AssertFileContent("public/p1/index.html", "Original")
diff --git a/hugolib/renderstring_test.go b/hugolib/renderstring_test.go
index 6d2aace74..adf2771f7 100644
--- a/hugolib/renderstring_test.go
+++ b/hugolib/renderstring_test.go
@@ -125,12 +125,7 @@ HasShortcode: foo:{{ .HasShortcode "foo" }}:false
`
t.Run("Basic", func(t *testing.T) {
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: filesTemplate,
- },
- ).Build()
+ b := Test(t, filesTemplate)
b.AssertFileContent("public/p1/index.html",
"Markdown: 1. Item Mark2 1
\n\nItem Mark2 2\n\nItem Mark2 2-1 \n \n \nItem Mark2 3|",
@@ -145,13 +140,7 @@ Page Type: *hugolib.pageForShortcode`,
})
t.Run("Edit shortcode", func(t *testing.T) {
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: filesTemplate,
- Running: true,
- },
- ).Build()
+ b := TestRunning(t, filesTemplate)
b.EditFiles("layouts/_shortcodes/myhthml.html", "Edit shortcode").Build()
diff --git a/hugolib/resource_chain_test.go b/hugolib/resource_chain_test.go
index ba6f30d76..efc18147a 100644
--- a/hugolib/resource_chain_test.go
+++ b/hugolib/resource_chain_test.go
@@ -1330,12 +1330,7 @@ Template test.
files := test.files
files = strings.ReplaceAll(files, "HTTPTEST_SERVER_URL", ts.URL)
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
test.assert(b)
})
diff --git a/hugolib/site_test.go b/hugolib/site_test.go
index dc9f14148..9909d5b55 100644
--- a/hugolib/site_test.go
+++ b/hugolib/site_test.go
@@ -66,12 +66,7 @@ publishdate: "2012-05-29"
baseURL = "http://auth/bub"
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
})
@@ -82,12 +77,7 @@ baseURL = "http://auth/bub"
baseURL = "http://auth/bub"
buildDrafts = true
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2)
})
@@ -98,12 +88,7 @@ buildDrafts = true
baseURL = "http://auth/bub"
buildFuture = true
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 2)
})
@@ -115,12 +100,7 @@ baseURL = "http://auth/bub"
buildDrafts = true
buildFuture = true
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 4)
})
}
@@ -198,13 +178,7 @@ weight: 3
# doc5
*some content*
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(b.H.Sites[0].Lastmod().IsZero(), qt.Equals, false)
b.Assert(b.H.Sites[0].Lastmod().Year(), qt.Equals, 2017)
@@ -226,13 +200,7 @@ date: 2014-05-29
# doc1
*some content*
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{SkipRender: true},
- },
- ).Build()
+ b := Test(t, files, TestOptSkipRender())
b.Assert(len(b.H.Sites[0].RegularPages()), qt.Equals, 1)
}
@@ -275,12 +243,7 @@ doc2 *content*
baseURL = "http://auth/bub"
uglyURLs = true
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", "Home Sweet Home.")
b.AssertFileContent("public/sect/doc1.html", "title \nsome content
\n")
@@ -301,12 +264,7 @@ uglyURLs = true
baseURL = "http://auth/bub"
uglyURLs = false
` + basefiles
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", "Home Sweet Home.")
b.AssertFileContent("public/sect/doc1/index.html", "title \nsome content
\n")
diff --git a/hugolib/template_test.go b/hugolib/template_test.go
index 90b8a575a..257964d5a 100644
--- a/hugolib/template_test.go
+++ b/hugolib/template_test.go
@@ -40,13 +40,7 @@ title: "Page"
Page Content
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/page/index.html", "Base: Hi!?")
}
@@ -115,13 +109,7 @@ baseURL = "http://example.com/"
title: The Page
---
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/blog/p1/index.html", `single`)
b.AssertFileContent("public/blog/index.html", `list`)
@@ -142,13 +130,7 @@ Base: {{ block "main" . }}{{ end }}
Bonjour
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `Base:
Bonjour`)
@@ -174,13 +156,7 @@ title: Home Sweet Home
title: P1
---
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `List: Home Sweet Home`)
b.AssertFileContent("public/p1/index.html", `Single: P1`)
@@ -222,13 +198,7 @@ Baseof mysection: {{ block "main" . }}mysection block{{ end }}
title: My Page
---
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/en/index.html", `Baseof en: Main Home En`)
b.AssertFileContent("public/fr/index.html", `Baseof fr: Main Home Fr`)
@@ -261,13 +231,7 @@ Site: {{ site.Language.Lang }} / {{ .Site.Language.Lang }} / {{ site.BaseURL }}
Sites: {{ site.Sites.Default.Home.Language.Lang }}
Hugo: {{ hugo.Generator }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/en/index.html",
"Site: en / en / http://example.com/blog",
@@ -309,13 +273,7 @@ dollarContext: 60: {{ partial "dollarContext.tpl" 18 }}
adder: 70: {{ partial "dict.tpl" (dict "adder" 28) }}
complex: 80: {{ partial "complex.tpl" 38 }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
add42: 50: 50
@@ -344,13 +302,7 @@ X{{ partial "retval" 0 }}X
{{ end }}
-- content/p.md --
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html",
`
@@ -377,13 +329,7 @@ Partial cached3: {{ partialCached "p1" "input3" $key2 }}
-- layouts/_partials/p1.html --
partial: {{ . }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
Partial cached1: partial: input1
@@ -415,13 +361,7 @@ with: Zero {{ with $zero }}FAIL{{ else }}OK{{ end }}
title: p1
---
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
if: Zero: OK
@@ -461,13 +401,7 @@ Population in Norway is {{
| upper
}}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
@@ -497,13 +431,7 @@ P2: {{ $p2 }}
{{ return $value }}
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html",
`
@@ -541,13 +469,7 @@ P2: {{ $p2 }}
{{ return $value }}
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html",
`
@@ -585,13 +507,7 @@ This is home main
This is single main
{{ end }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `
Home Header
@@ -619,13 +535,7 @@ baseURL = "http://example.com/"
{{ $a := apply $b "strings.Trim" "." " " }}
a: {{ $a }}
`
- b := NewIntegrationTestBuilder(
- IntegrationTestConfig{
- T: t,
- TxtarString: files,
- BuildCfg: BuildCfg{},
- },
- ).Build()
+ b := Test(t, files)
b.AssertFileContent("public/index.html", `a: [a b c]`)
}
diff --git a/internal/js/esbuild/batch_integration_test.go b/internal/js/esbuild/batch_integration_test.go
index e61b7acd5..e29eaf9c1 100644
--- a/internal/js/esbuild/batch_integration_test.go
+++ b/internal/js/esbuild/batch_integration_test.go
@@ -22,7 +22,6 @@ import (
qt "github.com/frankban/quicktest"
- "github.com/bep/logg"
"github.com/gohugoio/hugo/common/paths"
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
@@ -679,16 +678,7 @@ Home.
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- TxtarString: files,
- Running: true,
- LogLevel: logg.LevelWarn,
- // PrintAndKeepTempDir: true,
- }).Build()
+ b := hugolib.TestRunning(t, files, hugolib.TestOptWithOSFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptWarn())
b.AssertFileContent("public/index.html",
"mains: 0: /mybundle/mains.js",
diff --git a/markup/goldmark/codeblocks/codeblocks_integration_test.go b/markup/goldmark/codeblocks/codeblocks_integration_test.go
index 1eb88d34d..c3808359d 100644
--- a/markup/goldmark/codeblocks/codeblocks_integration_test.go
+++ b/markup/goldmark/codeblocks/codeblocks_integration_test.go
@@ -291,12 +291,7 @@ Attributes: {{ .Attributes }}|Options: {{ .Options }}|
`
testLanguage := func(language, expect string) {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: strings.ReplaceAll(files, "LANGUAGE", language),
- },
- ).Build()
+ b := hugolib.Test(t, strings.ReplaceAll(files, "LANGUAGE", language))
b.AssertFileContent("public/p1/index.html", expect)
}
@@ -339,12 +334,7 @@ Common
} {
t.Run(test.name, func(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: strings.ReplaceAll(files, "BLOCK", test.markdown),
- },
- ).Build()
+ b := hugolib.Test(t, strings.ReplaceAll(files, "BLOCK", test.markdown))
b.AssertFileContent("public/p1/index.html", "Common")
})
@@ -376,12 +366,7 @@ Hello, World!
Attributes: {{ .Attributes }}|Type: {{ .Type }}|
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err, qt.Not(qt.IsNil))
b.Assert(err.Error(), qt.Contains, "p1.md:7:9\": failed to parse Markdown attributes; you may need to quote the values")
diff --git a/markup/goldmark/goldmark_integration_test.go b/markup/goldmark/goldmark_integration_test.go
index ca750de45..1f7cff8b3 100644
--- a/markup/goldmark/goldmark_integration_test.go
+++ b/markup/goldmark/goldmark_integration_test.go
@@ -384,12 +384,7 @@ a@b.com
files = strings.ReplaceAll(files, "RENDERFUNC", renderFunc)
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "text is already rendered, repeating it may cause infinite recursion")
@@ -449,12 +444,7 @@ Link https procol: https://www.example.org
{{ .Text }} `
}
- return hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ return hugolib.Test(t, files)
}
for _, withHook := range []bool{false, true} {
diff --git a/resources/page/page_integration_test.go b/resources/page/page_integration_test.go
index 79580f758..6ec224f93 100644
--- a/resources/page/page_integration_test.go
+++ b/resources/page/page_integration_test.go
@@ -59,12 +59,7 @@ date: "2020-02-01"
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/en/index.html", "0|February, 2020|Pages(1)1|January, 2020|Pages(1)")
b.AssertFileContent("public/fr/index.html", "0|février, 2020|Pages(1)1|janvier, 2020|Pages(1)")
@@ -117,12 +112,7 @@ ByWeight: {{ range site.RegularPages.ByWeight }}{{ .Title }}|{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/en/index.html", `
ByTitle: alpha|émotion|zulu|
diff --git a/resources/page/permalinks_integration_test.go b/resources/page/permalinks_integration_test.go
index 9406d133c..08fefeb7c 100644
--- a/resources/page/permalinks_integration_test.go
+++ b/resources/page/permalinks_integration_test.go
@@ -112,12 +112,7 @@ slug: "mytagslug"
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
t.Log(b.LogString())
// No .File.TranslationBaseName on zero object etc. warnings.
@@ -168,12 +163,7 @@ slug: "p1slugvalue"
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
t.Log(b.LogString())
// No .File.TranslationBaseName on zero object etc. warnings.
@@ -221,12 +211,7 @@ Single.
List.
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
t.Log(b.LogString())
// No .File.TranslationBaseName on zero object etc. warnings.
@@ -270,12 +255,7 @@ Single.
List.
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
t.Log(b.LogString())
// No .File.TranslationBaseName on zero object etc. warnings.
@@ -311,12 +291,7 @@ title: Recipe 2
slug: custom-recipe-2
---
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelWarn,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptWarn())
t.Log(b.LogString())
b.Assert(b.H.Log.LoggCount(logg.LevelWarn), qt.Equals, 0)
diff --git a/resources/resource_factories/create/create_integration_test.go b/resources/resource_factories/create/create_integration_test.go
index e210915ef..897055432 100644
--- a/resources/resource_factories/create/create_integration_test.go
+++ b/resources/resource_factories/create/create_integration_test.go
@@ -47,14 +47,7 @@ func TestGetRemoteHead(t *testing.T) {
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html",
"Head Content: .",
@@ -83,14 +76,7 @@ func TestGetRemoteResponseHeaders(t *testing.T) {
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html",
"Response Headers: map[Server:[Netlify] X-Frame-Options:[DENY]]",
@@ -147,14 +133,7 @@ mediaTypes = ['text/plain']
t.Run("OK", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "TIMEOUT", "60s")
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- b.Build()
+ b := hugolib.Test(t, files)
for i := range numPages {
b.AssertFileContent(fmt.Sprintf("public/post/p%d/index.html", i), fmt.Sprintf("Content: Response for /post/p%d/.", i))
@@ -163,12 +142,7 @@ mediaTypes = ['text/plain']
t.Run("Timeout", func(t *testing.T) {
files := strings.ReplaceAll(filesTemplate, "TIMEOUT", "100ms")
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
// This is hard to get stable on GitHub Actions, it sometimes succeeds due to timing issues.
if err != nil {
b.AssertLogContains("Got Err")
@@ -209,13 +183,7 @@ mediaTypes = ['text/plain']
`
files = strings.ReplaceAll(files, "URL", srv.URL)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
// The per-request timeout of 200ms should fire well before the global 30s timeout.
b.AssertFileContent("public/index.html", "Err:")
@@ -257,13 +225,7 @@ mediaTypes = ['text/plain']
`
files = strings.ReplaceAll(files, "URL", srv.URL)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", "Content: Hello from remote.")
}
diff --git a/resources/resource_transformers/babel/babel_integration_test.go b/resources/resource_transformers/babel/babel_integration_test.go
index c08114b6c..1153c775d 100644
--- a/resources/resource_transformers/babel/babel_integration_test.go
+++ b/resources/resource_transformers/babel/babel_integration_test.go
@@ -16,7 +16,6 @@ package babel_test
import (
"testing"
- "github.com/bep/logg"
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
)
@@ -75,14 +74,7 @@ Transpiled3: {{ $transpiled.Permalink }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo())
b.AssertLogContains("babel: Hugo Environment: production")
b.AssertFileContent("public/index.html", `var Car2 =`)
diff --git a/resources/resource_transformers/cssjs/postcss_integration_test.go b/resources/resource_transformers/cssjs/postcss_integration_test.go
index 5ddae9070..02707fd5f 100644
--- a/resources/resource_transformers/cssjs/postcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/postcss_integration_test.go
@@ -20,7 +20,6 @@ import (
"strings"
"testing"
- "github.com/bep/logg"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/htesting"
@@ -120,15 +119,9 @@ func TestTransformPostCSS(t *testing.T) {
files := repl.Replace(postCSSIntegrationTestFiles)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- WorkingDir: tempDir,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo(), hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
+ cfg.WorkingDir = tempDir
+ }))
b.AssertFileContent("public/index.html", `
Styles RelPermalink: /foo/css/styles.css
@@ -155,13 +148,7 @@ func TestTransformPostCSSError(t *testing.T) {
c := qt.New(t)
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- TxtarString: strings.ReplaceAll(postCSSIntegrationTestFiles, "color: blue;", "@apply foo;"), // Syntax error
- }).BuildE()
+ b, err := hugolib.TestE(c, strings.ReplaceAll(postCSSIntegrationTestFiles, "color: blue;", "@apply foo;"), hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall())
ferrs := herrors.UnwrapFileErrors(err)
b.Assert(len(ferrs), qt.Equals, 2)
@@ -175,12 +162,7 @@ func TestTransformPostCSSNotInstalledError(t *testing.T) {
c := qt.New(t)
- _, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- TxtarString: postCSSIntegrationTestFiles,
- }).BuildE()
+ _, err := hugolib.TestE(c, postCSSIntegrationTestFiles, hugolib.TestOptOsFs())
ferrs := herrors.UnwrapFileErrors(err)
c.Assert(len(ferrs), qt.Equals, 1)
@@ -195,14 +177,7 @@ func TestTransformPostCSSImportError(t *testing.T) {
c := qt.New(t)
- _, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- TxtarString: strings.ReplaceAll(postCSSIntegrationTestFiles, `@import "components/all.css";`, `@import "components/doesnotexist.css";`),
- }).BuildE()
+ _, err := hugolib.TestE(c, strings.ReplaceAll(postCSSIntegrationTestFiles, `@import "components/all.css";`, `@import "components/doesnotexist.css";`), hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo())
ferrs := herrors.UnwrapFileErrors(err)
c.Assert(len(ferrs), qt.Equals, 2)
c.Assert(err.Error(), qt.Contains, "styles.css:4:3")
@@ -219,14 +194,7 @@ func TestTransformPostCSSImporSkipInlineImportsNotFound(t *testing.T) {
files := strings.ReplaceAll(postCSSIntegrationTestFiles, `@import "components/all.css";`, `@import "components/doesnotexist.css";`)
files = strings.ReplaceAll(files, `{{ $options := dict "inlineImports" true }}`, `{{ $options := dict "inlineImports" true "skipInlineImportsNotFound" true }}`)
- s := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- TxtarString: files,
- }).Build()
+ s := hugolib.Test(c, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo())
s.AssertFileContent("public/css/styles.css", `@import "components/doesnotexist.css";`)
}
@@ -250,15 +218,9 @@ func TestTransformPostCSSResourceCacheWithPathInBaseURL(t *testing.T) {
files = strings.ReplaceAll(files, "useResourceCacheWhen = 'never'", " useResourceCacheWhen = 'always'")
}
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- TxtarString: files,
- WorkingDir: tempDir,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo(), hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
+ cfg.WorkingDir = tempDir
+ }))
b.AssertFileContent("public/index.html", `
Styles Content: Len: 770917
diff --git a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
index 01ad9fa94..e2ce293e3 100644
--- a/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
+++ b/resources/resource_transformers/cssjs/tailwindcss_integration_test.go
@@ -16,7 +16,6 @@ package cssjs_test
import (
"testing"
- "github.com/bep/logg"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/htesting"
"github.com/gohugoio/hugo/hugolib"
@@ -60,14 +59,7 @@ func TestTailwindV4Basic(t *testing.T) {
CSS: {{ $css.Content | safeCSS }}|
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo())
b.AssertFileContent("public/index.html", "/*! tailwindcss v4.")
}
@@ -122,14 +114,7 @@ target = 'assets/css'
}
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- LogLevel: logg.LevelInfo,
- }).BuildE()
+ b, err := hugolib.TestE(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptInfo())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, "Can't resolve 'colors/red.css'")
diff --git a/resources/resource_transformers/js/js_integration_test.go b/resources/resource_transformers/js/js_integration_test.go
index ee84ee752..a11a6fbe9 100644
--- a/resources/resource_transformers/js/js_integration_test.go
+++ b/resources/resource_transformers/js/js_integration_test.go
@@ -56,13 +56,13 @@ JS Content:{{ $js.Content }}:End:
`
c.Run("Basic", func(c *qt.C) {
- b := hugolib.NewIntegrationTestBuilder(hugolib.IntegrationTestConfig{T: c, NeedsOsFS: true, TxtarString: mainWithImport}).Build()
+ b := hugolib.Test(c, mainWithImport, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `abcd`)
})
c.Run("Edit Import", func(c *qt.C) {
- b := hugolib.NewIntegrationTestBuilder(hugolib.IntegrationTestConfig{T: c, Running: true, NeedsOsFS: true, TxtarString: mainWithImport}).Build()
+ b := hugolib.Test(c, mainWithImport, hugolib.TestOptRunning(), hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `abcd`)
b.EditFileReplaceFunc("assets/js/util1.js", func(s string) string { return strings.ReplaceAll(s, "abcd", "1234") }).Build()
@@ -70,7 +70,7 @@ JS Content:{{ $js.Content }}:End:
})
c.Run("Edit Import Nested", func(c *qt.C) {
- b := hugolib.NewIntegrationTestBuilder(hugolib.IntegrationTestConfig{T: c, Running: true, NeedsOsFS: true, TxtarString: mainWithImport}).Build()
+ b := hugolib.Test(c, mainWithImport, hugolib.TestOptRunning(), hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `efgh`)
b.EditFileReplaceFunc("assets/js/util2.js", func(s string) string { return strings.ReplaceAll(s, "efgh", "1234") }).Build()
@@ -106,14 +106,9 @@ require github.com/gohugoio/hugoTestProjectJSModImports v0.10.0 // indirect
}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- TxtarString: files,
- Verbose: true,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall(), hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
+ cfg.Verbose = true
+ }))
b.AssertFileContent("public/js/main.js", `
greeting: "greeting configured in mod2"
@@ -196,13 +191,7 @@ TS2: {{ template "print" $ts2 }}
}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- NeedsNpmInstall: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs(), hugolib.TestOptWithNpmInstall())
b.AssertFileContent("public/js/main.js", `//# sourceMappingURL=main.js.map`)
b.AssertFileContent("public/js/main.js.map", `"version":3`, "! ns-hugo") // linked
@@ -266,7 +255,7 @@ JS Content:{{ $js.Content }}:End:
c.Run("Import from main not found", func(c *qt.C) {
c.Parallel()
files := strings.Replace(filesTemplate, "import { hello1, hello2 }", "import { hello1, hello2, FOOBAR }", 1)
- b, err := hugolib.NewIntegrationTestBuilder(hugolib.IntegrationTestConfig{T: c, NeedsOsFS: true, TxtarString: files}).BuildE()
+ b, err := hugolib.TestE(c, files, hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `main.js:2:25": No matching export`)
})
@@ -274,7 +263,7 @@ JS Content:{{ $js.Content }}:End:
c.Run("Import from import not found", func(c *qt.C) {
c.Parallel()
files := strings.Replace(filesTemplate, "import { hello3 } from './util2';", "import { hello3, FOOBAR } from './util2';", 1)
- b, err := hugolib.NewIntegrationTestBuilder(hugolib.IntegrationTestConfig{T: c, NeedsOsFS: true, TxtarString: files}).BuildE()
+ b, err := hugolib.TestE(c, files, hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `util1.js:4:17": No matching export in`)
})
@@ -304,12 +293,7 @@ import 'imp3/foo.js';
files = strings.ReplaceAll(files, "IMPORT_SRC_DIR", importSrcDir)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- NeedsOsFS: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs())
expected := `
IMPORT_SRC_DIR:imp1/index.js
@@ -348,12 +332,7 @@ console.log("Hello 2");
{{ $js.RelPermalink }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- NeedsOsFS: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/js/main.js", `
License util1
@@ -383,12 +362,7 @@ class A {}
{{ $opts := dict "target" "es2020" "targetPath" "js/main.js" }}
{{ (resources.Get "ts/main.ts" | js.Build $opts).Publish }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- NeedsOsFS: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/js/main.js", "__decorateClass")
}
diff --git a/resources/resource_transformers/minifier/minifier_integration_test.go b/resources/resource_transformers/minifier/minifier_integration_test.go
index 656f4bb88..f77526818 100644
--- a/resources/resource_transformers/minifier/minifier_integration_test.go
+++ b/resources/resource_transformers/minifier/minifier_integration_test.go
@@ -35,12 +35,7 @@ new Date(2002, 04, 11)
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(c, files)
b.Assert(err, qt.IsNotNil)
b.Assert(err, qt.ErrorMatches, "(?s).*legacy octal numbers.*line 1.*")
diff --git a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
index 2301bd708..81591be71 100644
--- a/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
+++ b/resources/resource_transformers/tocss/dartsass/dartsass_integration_test.go
@@ -17,7 +17,6 @@ import (
"strings"
"testing"
- "github.com/bep/logg"
qt "github.com/frankban/quicktest"
"github.com/gohugoio/hugo/common/herrors"
"github.com/gohugoio/hugo/htesting"
@@ -47,12 +46,7 @@ moo {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: moo{color:#fff}`)
}
@@ -88,13 +82,7 @@ T1: {{ $r.Content | safeHTML }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
// Dart Sass does not follow regular CSS import, but they
// get pulled to the top.
@@ -132,13 +120,7 @@ T1: {{ $r.Content | safeHTML }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", "T1: #main {\n color: blue;\n}\n\n/* foo */")
}
@@ -179,13 +161,7 @@ target = 'assets'
source = 'foo'
target = 'assets/foo'
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `
@import "import-this-file.css";
@@ -255,13 +231,7 @@ zoo {
@import "components/imports";
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: moo{color:#ccc}boo{color:green}zoo{color:pink}`)
}
@@ -285,13 +255,7 @@ disableKinds = ["term", "taxonomy", "section", "page"]
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- LogLevel: logg.LevelInfo,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptInfo())
b.AssertLogMatches(`Dart Sass: foo`)
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:1:0: bar`)
@@ -334,12 +298,7 @@ T1: {{ $r.Content }}
`
c.Run("error in main", func(c *qt.C) {
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: strings.Replace(filesTemplate, "$maincolor: #eee;", "$maincolor #eee;", 1),
- NeedsOsFS: true,
- }).BuildE()
+ b, err := hugolib.TestE(c, strings.Replace(filesTemplate, "$maincolor: #eee;", "$maincolor #eee;", 1), hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `main.scss:8:13":`)
@@ -359,12 +318,7 @@ T1: {{ $r.Content }}
})
c.Run("error in import", func(c *qt.C) {
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: strings.Replace(filesTemplate, "$foocolor: #ccc;", "$foocolor #ccc;", 1),
- NeedsOsFS: true,
- }).BuildE()
+ b, err := hugolib.TestE(c, strings.Replace(filesTemplate, "$foocolor: #ccc;", "$foocolor #ccc;", 1), hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `_foo.scss:2:10":`)
@@ -412,12 +366,7 @@ b {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo's New Roman}p{color:blue;font-size:24px}b{color:green}`)
}
@@ -460,12 +409,7 @@ b {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover}p{color:blue;font-size:24px}b{color:green}`)
}
@@ -516,13 +460,7 @@ float = 3.14
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- LogLevel: logg.LevelInfo,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptInfo())
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:3:0: color`)
b.AssertLogMatches(`Dart Sass: .*assets.*main.scss:4:0: color`)
@@ -564,12 +502,7 @@ module github.com/gohugoio/tests/testHugoModules
Styles: {{ $r.RelPermalink }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", "Styles: /scss/main.css")
}
@@ -609,12 +542,7 @@ target = "assets/sass"
.bar2 {color: blue;}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- NeedsOsFS: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", ".foo1{color:red}.bar1{color:blue}.foo2{color:red}.bar2{color:blue}")
}
diff --git a/resources/resource_transformers/tocss/scss/scss_integration_test.go b/resources/resource_transformers/tocss/scss/scss_integration_test.go
index 364979167..93cc05bf0 100644
--- a/resources/resource_transformers/tocss/scss/scss_integration_test.go
+++ b/resources/resource_transformers/tocss/scss/scss_integration_test.go
@@ -49,12 +49,7 @@ moo {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: moo{color:#fff}`)
}
@@ -92,12 +87,7 @@ T1: {{ $r.Content | safeHTML }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs())
// LibSass does not support regular CSS imports. There
// is an open bug about it that probably will never be resolved.
@@ -169,12 +159,7 @@ zoo {
@import "components/imports";
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(c, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: moo{color:#ccc}boo{color:green}zoo{color:pink}`)
}
@@ -217,12 +202,7 @@ T1: {{ $r.Content }}
`
c.Run("error in main", func(c *qt.C) {
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: strings.Replace(filesTemplate, "$maincolor: #eee;", "$maincolor #eee;", 1),
- NeedsOsFS: true,
- }).BuildE()
+ b, err := hugolib.TestE(c, strings.Replace(filesTemplate, "$maincolor: #eee;", "$maincolor #eee;", 1), hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, filepath.FromSlash(`themes/mytheme/assets/scss/main.scss:6:1": expected ':' after $maincolor in assignment statement`))
@@ -235,12 +215,7 @@ T1: {{ $r.Content }}
})
c.Run("error in import", func(c *qt.C) {
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: c,
- TxtarString: strings.Replace(filesTemplate, "$foocolor: #ccc;", "$foocolor #ccc;", 1),
- NeedsOsFS: true,
- }).BuildE()
+ b, err := hugolib.TestE(c, strings.Replace(filesTemplate, "$foocolor: #ccc;", "$foocolor #ccc;", 1), hugolib.TestOptOsFs())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `assets/scss/components/_foo.scss:2:1": expected ':' after $foocolor in assignment statement`)
@@ -287,12 +262,7 @@ b {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `T1: body body{background:url(images/hero.jpg) no-repeat center/cover;font-family:Hugo's New Roman}p{color:blue;font-size:var 24px}b{color:green}`)
}
@@ -323,12 +293,7 @@ module github.com/gohugoio/tests/testHugoModules
Styles: {{ $r.RelPermalink }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", "Styles: /scss/main.css")
}
@@ -350,13 +315,7 @@ b {
T1: {{ $r.Content }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- Running: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptRunning())
b.AssertFileContent("public/index.html", `color: red`)
@@ -407,14 +366,7 @@ h3 {
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- Running: true,
- // LogLevel: logg.LevelTrace,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptRunning())
b.AssertFileContent("public/index.html", `b.60a9f3bdc189ee8a857afd5b7e1b93ad1644de0873761a7c9bc84f781a821942.css`)
@@ -458,12 +410,7 @@ target = "assets/sass"
.bar2 {color: blue;}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- NeedsOsFS: true,
- TxtarString: files,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", ".foo1{color:red}.bar1{color:blue}.foo2{color:red}.bar2{color:blue}")
}
diff --git a/resources/resources_integration_test.go b/resources/resources_integration_test.go
index 8d0f13bb6..71216e304 100644
--- a/resources/resources_integration_test.go
+++ b/resources/resources_integration_test.go
@@ -52,13 +52,7 @@ bmp: {{ $bmp.RelPermalink }}|}|{{ $bmp.Width }}|{{ $bmp.Height }}|{{ $bmp.MediaT
anigif: {{ $anigif.RelPermalink }}|{{ $anigif.Width }}|{{ $anigif.Height }}|{{ $anigif.MediaType }}|
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- Running: true,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptRunning())
assertImages := func() {
b.AssertFileContent("public/index.html", `
@@ -88,13 +82,7 @@ func TestSVGError(t *testing.T) {
Width: {{ $svg.Width }}
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- Running: true,
- }).BuildE()
+ b, err := hugolib.TestE(t, files, hugolib.TestOptOsFs(), hugolib.TestOptRunning())
b.Assert(err, qt.IsNotNil)
b.Assert(err.Error(), qt.Contains, `error calling Width: resource "/circle.svg" of media type "image/svg+xml" does not support this method: use reflect.IsImageResource, reflect.IsImageResourceProcessable, or reflect.IsImageResourceWithMeta to check if the resource supports this method before calling it`)
@@ -124,13 +112,9 @@ iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNkYPhfDwAChwGA60e6kgAA
for range 3 {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- WorkingDir: workingDir,
- }).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs(), hugolib.TestOptWithConfig(func(cfg *hugolib.IntegrationTestConfig) {
+ cfg.WorkingDir = workingDir
+ }))
b.AssertFileCount("resources/_gen/images", 6)
b.AssertFileCount("public/images", 1)
diff --git a/tpl/collections/collections_integration_test.go b/tpl/collections/collections_integration_test.go
index 5f5ce10dd..88f62286f 100644
--- a/tpl/collections/collections_integration_test.go
+++ b/tpl/collections/collections_integration_test.go
@@ -74,12 +74,7 @@ Desc: {{ sort (sort $values "b" "desc") "a" "desc" }}
for range 4 {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", `
Asc: [map[a:0 b:0] map[a:0 b:0] map[a:0 b:3] map[a:1 b:0] map[a:1 b:1] map[a:1 b:2] map[a:1 b:2] map[a:2 b:0] map[a:2 b:0] map[a:2 b:0] map[a:2 b:1] map[a:2 b:2] map[a:3 b:0] map[a:3 b:0] map[a:3 b:0] map[a:3 b:0] map[a:3 b:1] map[a:3 b:1] map[a:3 b:1] map[a:3 b:3]]
@@ -144,12 +139,7 @@ func TestAppendNilsToSliceWithNils(t *testing.T) {
for range 4 {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", "[a <nil> c <nil>]")
diff --git a/tpl/debug/debug_integration_test.go b/tpl/debug/debug_integration_test.go
index c03655add..342ca5488 100644
--- a/tpl/debug/debug_integration_test.go
+++ b/tpl/debug/debug_integration_test.go
@@ -16,7 +16,6 @@ package debug_test
import (
"testing"
- "github.com/bep/logg"
"github.com/gohugoio/hugo/hugolib"
)
@@ -33,13 +32,7 @@ disableKinds = ["taxonomy", "term"]
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- LogLevel: logg.LevelInfo,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptInfo())
b.AssertLogContains("timer: name foo count 5 duration")
}
diff --git a/tpl/os/os_integration_test.go b/tpl/os/os_integration_test.go
index cd9cadba3..209f9e0f8 100644
--- a/tpl/os/os_integration_test.go
+++ b/tpl/os/os_integration_test.go
@@ -37,13 +37,7 @@ START:|{{ range $entry := $entries }}{{ if not $entry.IsDir }}{{ $entry.Name }}|
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `
START:|hugo.toml|myproject.txt|:END:
@@ -63,13 +57,7 @@ func TestReadFileNotExists(t *testing.T) {
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/index.html", `
OK
diff --git a/tpl/os/os_test.go b/tpl/os/os_test.go
index 399adb374..8245b44f1 100644
--- a/tpl/os/os_test.go
+++ b/tpl/os/os_test.go
@@ -26,7 +26,7 @@ import (
func TestReadFile(t *testing.T) {
t.Parallel()
- b := newFileTestBuilder(t).Build()
+ b := newFileTestBuilder(t)
// helpers.PrintFs(b.H.PathSpec.BaseFs.Work, "", _os.Stdout)
@@ -59,7 +59,7 @@ func TestFileExists(t *testing.T) {
t.Parallel()
c := qt.New(t)
- b := newFileTestBuilder(t).Build()
+ b := newFileTestBuilder(t)
ns := os.New(b.H.Deps)
for _, test := range []struct {
@@ -86,7 +86,7 @@ func TestFileExists(t *testing.T) {
func TestStat(t *testing.T) {
t.Parallel()
- b := newFileTestBuilder(t).Build()
+ b := newFileTestBuilder(t)
ns := os.New(b.H.Deps)
for _, test := range []struct {
@@ -118,11 +118,7 @@ f1-content
f2-content
`
- return hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- WorkingDir: "/mywork",
- },
- )
+ return hugolib.Test(t, files, hugolib.TestOptWithConfig(func(c *hugolib.IntegrationTestConfig) {
+ c.WorkingDir = "/mywork"
+ }))
}
diff --git a/tpl/page/page_integration_test.go b/tpl/page/page_integration_test.go
index 6b5fc7ca4..817033b40 100644
--- a/tpl/page/page_integration_test.go
+++ b/tpl/page/page_integration_test.go
@@ -140,12 +140,7 @@ weight = 2
for range 1 {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", `
Heading OK.
diff --git a/tpl/partials/partials_integration_test.go b/tpl/partials/partials_integration_test.go
index 04ea82bfd..79a92f1e1 100644
--- a/tpl/partials/partials_integration_test.go
+++ b/tpl/partials/partials_integration_test.go
@@ -261,12 +261,7 @@ baseURL = 'http://example.com/'
{{ partial "foo.html" . }}
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err, qt.Not(qt.IsNil))
b.Assert(err.Error(), qt.Contains, "maximum template call stack size exceeded")
@@ -287,12 +282,7 @@ timeout = '200ms'
{{ partialCached "foo.html" . }}
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err, qt.Not(qt.IsNil))
b.Assert(err.Error(), qt.Contains, `error calling partialCached: circular call stack detected in partial`)
diff --git a/tpl/resources/resources_integration_test.go b/tpl/resources/resources_integration_test.go
index 60889cb07..faca7af3a 100644
--- a/tpl/resources/resources_integration_test.go
+++ b/tpl/resources/resources_integration_test.go
@@ -85,11 +85,7 @@ func TestCopyPageShouldFail(t *testing.T) {
`
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- }).BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err, qt.IsNotNil)
}
diff --git a/tpl/time/time_test.go b/tpl/time/time_test.go
index 87656b38c..9bb17b465 100644
--- a/tpl/time/time_test.go
+++ b/tpl/time/time_test.go
@@ -29,9 +29,7 @@ import (
func TestTimeLocation(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
loc, _ := gtime.LoadLocation("America/Antigua")
ns := time.New(htime.NewTimeFormatter(golocales.New("en")), loc, b.H.Deps)
@@ -91,9 +89,7 @@ func TestTimeLocation(t *testing.T) {
func TestFormat(t *testing.T) {
c := qt.New(t)
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
c.Run("UTC", func(c *qt.C) {
c.Parallel()
@@ -153,9 +149,7 @@ func TestFormat(t *testing.T) {
func TestDuration(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := time.New(htime.NewTimeFormatter(golocales.New("en")), gtime.UTC, b.H.Deps)
@@ -200,9 +194,7 @@ func TestDuration(t *testing.T) {
func TestIn(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := time.New(htime.NewTimeFormatter(golocales.New("en")), gtime.UTC, b.H.Deps)
@@ -241,9 +233,7 @@ func TestIn(t *testing.T) {
var timeZoneNames []string = []string{"America/New_York", "Europe/Oslo", "Australia/Sydney", "UTC", "Local"}
func BenchmarkInWithCaching(b *testing.B) {
- bb := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: b},
- ).Build()
+ bb := hugolib.Test(b, "")
ns := time.New(htime.NewTimeFormatter(golocales.New("en")), gtime.UTC, bb.H.Deps)
diff --git a/tpl/tplimpl/template_funcs_test.go b/tpl/tplimpl/template_funcs_test.go
index d71c3e445..12ffacc95 100644
--- a/tpl/tplimpl/template_funcs_test.go
+++ b/tpl/tplimpl/template_funcs_test.go
@@ -46,13 +46,7 @@ title: "**BatMan**"
---
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
d := b.H.Sites[0].Deps
@@ -78,13 +72,7 @@ title: "**BatMan**"
}
files += fmt.Sprintf("-- layouts/single.html --\n%s\n", strings.Join(templates, "\n"))
- b = hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- ).Build()
+ b = hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/blog/hugo-rocks/index.html", expected...)
}
diff --git a/tpl/tplimpl/templatestore_integration_test.go b/tpl/tplimpl/templatestore_integration_test.go
index 6ba9cbbc4..e8229a0d5 100644
--- a/tpl/tplimpl/templatestore_integration_test.go
+++ b/tpl/tplimpl/templatestore_integration_test.go
@@ -379,14 +379,7 @@ title: "P1"
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/p1/index.html", "MAIN /_default/single.html")
diff --git a/tpl/tplimpl/tplimpl_integration_test.go b/tpl/tplimpl/tplimpl_integration_test.go
index 420988f4f..f232b0fea 100644
--- a/tpl/tplimpl/tplimpl_integration_test.go
+++ b/tpl/tplimpl/tplimpl_integration_test.go
@@ -55,14 +55,7 @@ counter2: {{ .Scratch.Get "counter" }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- NeedsOsFS: true,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files, hugolib.TestOptOsFs())
b.AssertFileContent("public/p1/index.html", `
continue:1345:END:
@@ -124,13 +117,7 @@ title: "S3P1"
{{ define "main" }}{{ .Title }}{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/s1/p1/index.html", `S1P1`)
b.AssertFileContent("public/s2/p1/index.html", `S2P1`)
@@ -152,13 +139,7 @@ func TestGoTemplateBugs(t *testing.T) {
{{ end }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
- b.Build()
+ b := hugolib.Test(t, files)
b.AssertFileContent("public/index.html", `key = value`)
})
@@ -176,12 +157,7 @@ var a = §§{{.Title }}§§;
files := strings.ReplaceAll(filesTemplate, "SECURITYCONFIG", "")
- b, err := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- ).BuildE()
+ b, err := hugolib.TestE(t, files)
// This used to fail, but not in >= Hugo 0.121.0.
b.Assert(err, qt.IsNil)
diff --git a/tpl/transform/remarshal_test.go b/tpl/transform/remarshal_test.go
index bbd7acf66..26ea28bc3 100644
--- a/tpl/transform/remarshal_test.go
+++ b/tpl/transform/remarshal_test.go
@@ -26,9 +26,7 @@ import (
func TestRemarshal(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
c := qt.New(t)
@@ -241,9 +239,7 @@ c: &c [*b, *b, *b, *b, *b, *b, *b, *b, *b, *b]
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
diff --git a/tpl/transform/transform_integration_test.go b/tpl/transform/transform_integration_test.go
index 6347452cf..9e7f7006b 100644
--- a/tpl/transform/transform_integration_test.go
+++ b/tpl/transform/transform_integration_test.go
@@ -99,14 +99,7 @@ disableKinds = ['page','rss','section','sitemap','taxonomy','term']
-- layouts/home.html --
{{ highlight "a" "b" 0 }}
`
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{
- T: t,
- TxtarString: files,
- },
- )
-
- _, err := b.BuildE()
+ b, err := hugolib.TestE(t, files)
b.Assert(err.Error(), qt.Contains, "error calling highlight: invalid Highlight option: 0")
}
diff --git a/tpl/transform/transform_test.go b/tpl/transform/transform_test.go
index 1f6c99ec4..a74f9d5b5 100644
--- a/tpl/transform/transform_test.go
+++ b/tpl/transform/transform_test.go
@@ -29,9 +29,7 @@ type tstNoStringer struct{}
func TestEmojify(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -59,9 +57,7 @@ func TestEmojify(t *testing.T) {
func TestHighlight(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -104,9 +100,7 @@ func TestCanHighlight(t *testing.T) {
func TestHTMLEscape(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -134,9 +128,7 @@ func TestHTMLEscape(t *testing.T) {
func TestHTMLUnescape(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -164,9 +156,7 @@ func TestHTMLUnescape(t *testing.T) {
func TestMarkdownify(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -194,9 +184,7 @@ func TestMarkdownify(t *testing.T) {
// Issue #3040
func TestMarkdownifyBlocksOfText(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -220,9 +208,7 @@ And then some.
func TestPlainify(t *testing.T) {
t.Parallel()
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
diff --git a/tpl/transform/unmarshal_test.go b/tpl/transform/unmarshal_test.go
index 3d60dcda7..c2b177bd2 100644
--- a/tpl/transform/unmarshal_test.go
+++ b/tpl/transform/unmarshal_test.go
@@ -82,9 +82,7 @@ func (t testContentResource) Key() string {
}
func TestUnmarshal(t *testing.T) {
- b := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: t},
- ).Build()
+ b := hugolib.Test(t, "")
ns := transform.New(b.H.Deps)
@@ -191,9 +189,7 @@ a;b;c`, mime: media.Builtin.CSVType}, map[string]any{"DElimiter": ";", "Comment"
}
func BenchmarkUnmarshalString(b *testing.B) {
- bb := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: b},
- ).Build()
+ bb := hugolib.Test(b, "")
ns := transform.New(bb.H.Deps)
@@ -218,9 +214,7 @@ func BenchmarkUnmarshalString(b *testing.B) {
}
func BenchmarkUnmarshalResource(b *testing.B) {
- bb := hugolib.NewIntegrationTestBuilder(
- hugolib.IntegrationTestConfig{T: b},
- ).Build()
+ bb := hugolib.Test(b, "")
ns := transform.New(bb.H.Deps)