"github.com/bep/helpers/envhelpers"
"github.com/gohugoio/hugo/commands"
+ "github.com/gohugoio/hugo/htesting"
"github.com/rogpeppe/go-internal/testscript"
)
func TestCommands(t *testing.T) {
- // These are somewhat flakey and takes some time,
- // so usefule to have a way to skip them when developing.
- const skipEnv = "HUGOTESTING_SKIP_COMMANDS"
- if os.Getenv(skipEnv) != "" {
- t.Skipf("skip because %s set in env", skipEnv)
- }
p := commonTestScriptsParam
p.Dir = "testscripts/commands"
testscript.Run(t, p)
}
+func TestServer(t *testing.T) {
+ // See issue #14439
+ htesting.SkipSlowTestUnlessCI(t)
+ p := commonTestScriptsParam
+ p.Dir = "testscripts/server"
+ testscript.Run(t, p)
+}
+
// Tests in development can be put in "testscripts/unfinished".
// Also see the watch_testscripts.sh script.
func TestUnfinished(t *testing.T) {
+++ /dev/null
-# Test the hugo command.
-
-# See https://github.com/rogpeppe/go-internal/issues/228
-[windows] skip
-
-hugo -w &
-
-sleep 3
-grep 'P1start' public/p1/index.html
-
-replace content/p1.md 'P1start' 'P1end'
-sleep 2
-grep 'P1end' public/p1/index.html
-! grep 'livereload' public/p1/index.html
-
-stop
-
--- hugo.toml --
-baseURL = "http://example.org/"
-disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
--- layouts/home.html --
-Home.
--- layouts/single.html --
-Title: {{ .Title }}| {{ .Content }}
--- content/p1.md --
----
-title: "P1"
----
-P1start
\ No newline at end of file
+++ /dev/null
-# Test the hugo server command.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-hugo server --renderToMemory --gc &
-
-waitServer
-
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0 'ServerPort: \d{4,5}' 'myenv: thedevelopment' 'livereload\.js' 'Env: development' 'IsServer: true'
-httpget ${HUGOTEST_BASEURL_0}doesnotexist 'custom 404'
-httpget ${HUGOTEST_BASEURL_0}livereload.js 'function'
-
-# By default, the server renders to memory.
-! exists public/index.html
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
--- config/production/params.toml --
-myenv = "theproduction"
--- config/development/params.toml --
-myenv = "thedevelopment"
--- layouts/home.html --
-<!DOCTYPE html>
-<body>
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|ServerPort: {{ site.ServerPort }}|myenv: {{ .Site.Params.myenv }}|Env: {{ hugo.Environment }}|IsServer: {{ hugo.IsServer }}|
-</body>
--- layouts/404.html --
-custom 404
+++ /dev/null
-# Test the hugo server command when editing the config file.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-hugo server --renderToMemory &
-
-waitServer
-
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
-
-mv edits/title.toml hugo.toml
-
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo New Server Test' $HUGOTEST_BASEURL_0
-
-mv edits/addlanguage.toml hugo.toml
-
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo New Server Test' $HUGOTEST_BASEURL_0
-httpget ${HUGOTEST_BASEURL_0}nn/ 'Hugo Nynorsk Server Test' ${HUGOTEST_BASEURL_0}nn/
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
--- edits/title.toml --
-title = "Hugo New Server Test"
-baseURL = "https://example.org/"
--- edits/addlanguage.toml --
-title = "Hugo New Server Test"
-baseURL = "https://example.org/"
-[languages]
-[languages.en]
-languageName = "English"
-weight = 1
-[languages.nn]
-languageName = "Nynorsk"
-title = "Hugo Nynorsk Server Test"
-weight = 2
-
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ .Permalink }}|
-
-
+++ /dev/null
-# Test the hugo server command when editing content.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-# Render to disk so we can check the /public dir.
-hugo server &
-
-waitServer
-
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' $HUGOTEST_BASEURL_0
-
-ls public/p2
-cp stdout lsp2_1.txt
-ls public/staticfiles
-stdout 'static\.txt'
-cp stdout lsstaticfiles_1.txt
-
-replace $WORK/content/p1/index.md 'P1' 'P1 New'
-
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1 New' $HUGOTEST_BASEURL_0
-
-ls public/p2
-cp stdout lsp2_2.txt
-cmp lsp2_1.txt lsp2_2.txt
-ls public/staticfiles
-cp stdout lsstaticfiles_2.txt
-cmp lsstaticfiles_1.txt lsstaticfiles_2.txt
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- layouts/single.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- content/_index.md --
----
-title: Hugo Home
----
--- content/p1/index.md --
----
-title: P1
----
--- content/p2/index.md --
----
-title: P2
----
--- static/staticfiles/static.txt --
-static
-
-
-
+++ /dev/null
-# Issue 14240.
-
-hugo server &
-
-waitServer
-
-httpget ${HUGOTEST_BASEURL_0}tags/%E6%AC%A2%E8%BF%8E/ '_P1_'
-
-replace $WORK/content/p1.md 'P1' 'P1 New'
-
-httpget ${HUGOTEST_BASEURL_0}tags/%E6%AC%A2%E8%BF%8E/ '_P1 New_'
-
-stopServer
-! stderr .
-
--- hugo.toml --
-baseURL = "https://example.com"
-disableLiveReload = true
--- layouts/all.html --
-All. {{ range .Pages }}_{{ .Title }}_{{ end }}$
--- content/p1.md --
----
-title: "P1"
-tags: ["欢迎"]
----
+++ /dev/null
-# Test the hugo server command when adding an error to a config file
-# and then fixing it.
-
-hugo server &
-
-waitServer
-
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
-
-replace $WORK/hugo.toml 'title =' 'titlefoo'
-httpget ${HUGOTEST_BASEURL_0}p1/ 'failed'
-
-replace $WORK/hugo.toml 'titlefoo' 'title ='
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
-
-stopServer
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- layouts/single.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- content/_index.md --
----
-title: Hugo Home
----
--- content/p1/index.md --
----
-title: P1
----
--- content/p2/index.md --
----
-title: P2
----
--- static/staticfiles/static.txt --
-static
-
-
-
+++ /dev/null
-# Test the hugo server command when adding a front matter error to a content file
-# and then fixing it.
-
-hugo server &
-
-waitServer
-
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
-
-replace $WORK/content/p1/index.md 'title:' 'titlecolon'
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Error'
-
-replace $WORK/content/p1/index.md 'titlecolon' 'title:'
-httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
-
-stopServer
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- layouts/single.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- content/_index.md --
----
-title: Hugo Home
----
--- content/p1/index.md --
----
-title: P1
----
--- content/p2/index.md --
----
-title: P2
----
--- static/staticfiles/static.txt --
-static
-
-
-
+++ /dev/null
-# Test the hugo server command.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-hugo server --renderToMemory &
-
-waitServer
-
-# Assert home page.
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
-httpget $HUGOTEST_BASEURL_1 'Title: Hugo Serveur Test' $HUGOTEST_BASEURL_1
-
-# Assert static mount.
-httpget ${HUGOTEST_BASEURL_0}mystatic/mytext.txt 'en_mytext'
-httpget ${HUGOTEST_BASEURL_1}mystatic/mytext.txt 'fr_mytext'
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
-
-[[module.mounts]]
-source = 'static/en'
-target = 'static'
-lang = 'en'
-[[module.mounts]]
-source = 'static/fr'
-target = 'static'
-lang = 'fr'
-
-[languages]
-[languages.en]
-baseURL = "https://en.example.org/"
-languageName = "English"
-title = "Hugo Server Test"
-weight = 1
-[languages.fr]
-baseURL = "https://fr.example.org/"
-title = "Hugo Serveur Test"
-languageName = "Français"
-weight = 2
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
--- static/en/mystatic/mytext.txt --
-en_mytext
--- static/fr/mystatic/mytext.txt --
-fr_mytext
-
-
+++ /dev/null
-hugo server --renderToMemory &
-
-waitServer
-stopServer
-! stderr .
-
-exists hugo_stats.json
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
-[module]
-[[module.mounts]]
-source = "hugo_stats.json"
-target = "assets/watching/hugo_stats.json"
--- layouts/home.html --
-<body>Home</body>
+++ /dev/null
-hugo server --renderToMemory --disableLiveReload &
-
-waitServer
-stopServer
-wait
-! stderr .
-stdout 'Watching for config changes in.*mytheme'
-
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["section", "page", "taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404"]
-theme = "mytheme"
--- layouts/home.html --
-foo: {{ .Site.Params.foo }}
--- themes/mytheme/hugo.toml --
-[params]
- foo = "bar"
+++ /dev/null
-hugo server --disableLiveReload &
-
-waitServer
-
-! grep 'livereload' public/index.html
-
-stopServer
-! stderr .
-
--- hugo.toml --
-baseURL = "http://example.org/"
-disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
--- layouts/home.html --
-<html>
-<head>
-</head>
-<body>
-Home.
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-hugo server &
-
-waitServer
-
-! grep 'livereload' public/index.html
-
-stopServer
-! stderr .
-
--- hugo.toml --
-baseURL = "http://example.org/"
-disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
-disableLiveReload = true
--- layouts/home.html --
-<html>
-<head>
-</head>
-<body>
-Home.
-</body>
-</html>
\ No newline at end of file
+++ /dev/null
-# Test the hugo server command.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-hugo server --renderToMemory --renderStaticToDisk &
-
-waitServer
-
-httpget ${HUGOTEST_BASEURL_0}en/ 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
-httpget ${HUGOTEST_BASEURL_0}mystatic.txt 'This is a static file in English.'
-
-! exists public/index.html
-exists public/mystatic.txt
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
-defaultContentLanguage = "en"
-defaultContentLanguageInSubdir = true
-[[module.mounts]]
-source = 'static/en'
-target = 'static'
-lang = 'en'
-[[module.mounts]]
-source = 'static/fr'
-target = 'static'
-lang = 'fr'
-
-
-[languages]
-[languages.en]
-languageName = "English"
-title = "Hugo Server Test"
-weight = 1
-[languages.fr]
-title = "Hugo Serveur Test"
-languageName = "Français"
-weight = 2
-
--- static/en/mystatic.txt --
-This is a static file in English.
--- static/en/mystatic.txt --
-This is a static file in English.
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
-
-
+++ /dev/null
-# Test the hugo server command.
-
-# We run these tests in parallel so let Hugo decide which port to use.
-# Deliberately using the alias 'serve' here.
-hugo serve --renderToMemory &
-
-waitServer
-
-httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
-
-! exists public/index.html
-! exists public/mystatic.txt
-
-stopServer
-! stderr .
-
--- hugo.toml --
-title = "Hugo Server Test"
-baseURL = "https://example.org/"
-disableKinds = ["taxonomy", "term", "sitemap"]
--- static/mystatic.txt --
-This is a static file.
--- layouts/home.html --
-Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
-
-
--- /dev/null
+# Test the hugo command.
+
+# See https://github.com/rogpeppe/go-internal/issues/228
+[windows] skip
+
+hugo -w &
+
+sleep 3
+grep 'P1start' public/p1/index.html
+
+replace content/p1.md 'P1start' 'P1end'
+sleep 2
+grep 'P1end' public/p1/index.html
+! grep 'livereload' public/p1/index.html
+
+stop
+
+-- hugo.toml --
+baseURL = "http://example.org/"
+disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
+-- layouts/home.html --
+Home.
+-- layouts/single.html --
+Title: {{ .Title }}| {{ .Content }}
+-- content/p1.md --
+---
+title: "P1"
+---
+P1start
\ No newline at end of file
--- /dev/null
+# Test the hugo server command.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+hugo server --renderToMemory --gc &
+
+waitServer
+
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0 'ServerPort: \d{4,5}' 'myenv: thedevelopment' 'livereload\.js' 'Env: development' 'IsServer: true'
+httpget ${HUGOTEST_BASEURL_0}doesnotexist 'custom 404'
+httpget ${HUGOTEST_BASEURL_0}livereload.js 'function'
+
+# By default, the server renders to memory.
+! exists public/index.html
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+-- config/production/params.toml --
+myenv = "theproduction"
+-- config/development/params.toml --
+myenv = "thedevelopment"
+-- layouts/home.html --
+<!DOCTYPE html>
+<body>
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|ServerPort: {{ site.ServerPort }}|myenv: {{ .Site.Params.myenv }}|Env: {{ hugo.Environment }}|IsServer: {{ hugo.IsServer }}|
+</body>
+-- layouts/404.html --
+custom 404
--- /dev/null
+# Test the hugo server command when editing the config file.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+hugo server --renderToMemory &
+
+waitServer
+
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
+
+mv edits/title.toml hugo.toml
+
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo New Server Test' $HUGOTEST_BASEURL_0
+
+mv edits/addlanguage.toml hugo.toml
+
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo New Server Test' $HUGOTEST_BASEURL_0
+httpget ${HUGOTEST_BASEURL_0}nn/ 'Hugo Nynorsk Server Test' ${HUGOTEST_BASEURL_0}nn/
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+-- edits/title.toml --
+title = "Hugo New Server Test"
+baseURL = "https://example.org/"
+-- edits/addlanguage.toml --
+title = "Hugo New Server Test"
+baseURL = "https://example.org/"
+[languages]
+[languages.en]
+languageName = "English"
+weight = 1
+[languages.nn]
+languageName = "Nynorsk"
+title = "Hugo Nynorsk Server Test"
+weight = 2
+
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ .Permalink }}|
+
+
--- /dev/null
+# Test the hugo server command when editing content.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+# Render to disk so we can check the /public dir.
+hugo server &
+
+waitServer
+
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1' $HUGOTEST_BASEURL_0
+
+ls public/p2
+cp stdout lsp2_1.txt
+ls public/staticfiles
+stdout 'static\.txt'
+cp stdout lsstaticfiles_1.txt
+
+replace $WORK/content/p1/index.md 'P1' 'P1 New'
+
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1 New' $HUGOTEST_BASEURL_0
+
+ls public/p2
+cp stdout lsp2_2.txt
+cmp lsp2_1.txt lsp2_2.txt
+ls public/staticfiles
+cp stdout lsstaticfiles_2.txt
+cmp lsstaticfiles_1.txt lsstaticfiles_2.txt
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- layouts/single.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- content/_index.md --
+---
+title: Hugo Home
+---
+-- content/p1/index.md --
+---
+title: P1
+---
+-- content/p2/index.md --
+---
+title: P2
+---
+-- static/staticfiles/static.txt --
+static
+
+
+
--- /dev/null
+# Issue 14240.
+
+hugo server &
+
+waitServer
+
+httpget ${HUGOTEST_BASEURL_0}tags/%E6%AC%A2%E8%BF%8E/ '_P1_'
+
+replace $WORK/content/p1.md 'P1' 'P1 New'
+
+httpget ${HUGOTEST_BASEURL_0}tags/%E6%AC%A2%E8%BF%8E/ '_P1 New_'
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+baseURL = "https://example.com"
+disableLiveReload = true
+-- layouts/all.html --
+All. {{ range .Pages }}_{{ .Title }}_{{ end }}$
+-- content/p1.md --
+---
+title: "P1"
+tags: ["欢迎"]
+---
--- /dev/null
+# Test the hugo server command when adding an error to a config file
+# and then fixing it.
+
+hugo server &
+
+waitServer
+
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
+
+replace $WORK/hugo.toml 'title =' 'titlefoo'
+httpget ${HUGOTEST_BASEURL_0}p1/ 'failed'
+
+replace $WORK/hugo.toml 'titlefoo' 'title ='
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
+
+stopServer
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- layouts/single.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- content/_index.md --
+---
+title: Hugo Home
+---
+-- content/p1/index.md --
+---
+title: P1
+---
+-- content/p2/index.md --
+---
+title: P2
+---
+-- static/staticfiles/static.txt --
+static
+
+
+
--- /dev/null
+# Test the hugo server command when adding a front matter error to a content file
+# and then fixing it.
+
+hugo server &
+
+waitServer
+
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
+
+replace $WORK/content/p1/index.md 'title:' 'titlecolon'
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Error'
+
+replace $WORK/content/p1/index.md 'titlecolon' 'title:'
+httpget ${HUGOTEST_BASEURL_0}p1/ 'Title: P1'
+
+stopServer
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- layouts/single.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- content/_index.md --
+---
+title: Hugo Home
+---
+-- content/p1/index.md --
+---
+title: P1
+---
+-- content/p2/index.md --
+---
+title: P2
+---
+-- static/staticfiles/static.txt --
+static
+
+
+
--- /dev/null
+# Test the hugo server command.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+hugo server --renderToMemory &
+
+waitServer
+
+# Assert home page.
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
+httpget $HUGOTEST_BASEURL_1 'Title: Hugo Serveur Test' $HUGOTEST_BASEURL_1
+
+# Assert static mount.
+httpget ${HUGOTEST_BASEURL_0}mystatic/mytext.txt 'en_mytext'
+httpget ${HUGOTEST_BASEURL_1}mystatic/mytext.txt 'fr_mytext'
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+
+[[module.mounts]]
+source = 'static/en'
+target = 'static'
+lang = 'en'
+[[module.mounts]]
+source = 'static/fr'
+target = 'static'
+lang = 'fr'
+
+[languages]
+[languages.en]
+baseURL = "https://en.example.org/"
+languageName = "English"
+title = "Hugo Server Test"
+weight = 1
+[languages.fr]
+baseURL = "https://fr.example.org/"
+title = "Hugo Serveur Test"
+languageName = "Français"
+weight = 2
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+-- static/en/mystatic/mytext.txt --
+en_mytext
+-- static/fr/mystatic/mytext.txt --
+fr_mytext
+
+
--- /dev/null
+hugo server --renderToMemory &
+
+waitServer
+stopServer
+! stderr .
+
+exists hugo_stats.json
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+[module]
+[[module.mounts]]
+source = "hugo_stats.json"
+target = "assets/watching/hugo_stats.json"
+-- layouts/home.html --
+<body>Home</body>
--- /dev/null
+hugo server --renderToMemory --disableLiveReload &
+
+waitServer
+stopServer
+wait
+! stderr .
+stdout 'Watching for config changes in.*mytheme'
+
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["section", "page", "taxonomy", "term", "RSS", "sitemap", "robotsTXT", "404"]
+theme = "mytheme"
+-- layouts/home.html --
+foo: {{ .Site.Params.foo }}
+-- themes/mytheme/hugo.toml --
+[params]
+ foo = "bar"
--- /dev/null
+hugo server --disableLiveReload &
+
+waitServer
+
+! grep 'livereload' public/index.html
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+baseURL = "http://example.org/"
+disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
+-- layouts/home.html --
+<html>
+<head>
+</head>
+<body>
+Home.
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+hugo server &
+
+waitServer
+
+! grep 'livereload' public/index.html
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+baseURL = "http://example.org/"
+disableKinds = ["RSS", "sitemap", "robotsTXT", "404", "taxonomy", "term"]
+disableLiveReload = true
+-- layouts/home.html --
+<html>
+<head>
+</head>
+<body>
+Home.
+</body>
+</html>
\ No newline at end of file
--- /dev/null
+# Test the hugo server command.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+hugo server --renderToMemory --renderStaticToDisk &
+
+waitServer
+
+httpget ${HUGOTEST_BASEURL_0}en/ 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
+httpget ${HUGOTEST_BASEURL_0}mystatic.txt 'This is a static file in English.'
+
+! exists public/index.html
+exists public/mystatic.txt
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+defaultContentLanguage = "en"
+defaultContentLanguageInSubdir = true
+[[module.mounts]]
+source = 'static/en'
+target = 'static'
+lang = 'en'
+[[module.mounts]]
+source = 'static/fr'
+target = 'static'
+lang = 'fr'
+
+
+[languages]
+[languages.en]
+languageName = "English"
+title = "Hugo Server Test"
+weight = 1
+[languages.fr]
+title = "Hugo Serveur Test"
+languageName = "Français"
+weight = 2
+
+-- static/en/mystatic.txt --
+This is a static file in English.
+-- static/en/mystatic.txt --
+This is a static file in English.
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+
+
--- /dev/null
+# Test the hugo server command.
+
+# We run these tests in parallel so let Hugo decide which port to use.
+# Deliberately using the alias 'serve' here.
+hugo serve --renderToMemory &
+
+waitServer
+
+httpget $HUGOTEST_BASEURL_0 'Title: Hugo Server Test' $HUGOTEST_BASEURL_0
+
+! exists public/index.html
+! exists public/mystatic.txt
+
+stopServer
+! stderr .
+
+-- hugo.toml --
+title = "Hugo Server Test"
+baseURL = "https://example.org/"
+disableKinds = ["taxonomy", "term", "sitemap"]
+-- static/mystatic.txt --
+This is a static file.
+-- layouts/home.html --
+Title: {{ .Title }}|BaseURL: {{ site.BaseURL }}|
+
+