hugo
The atago project wrote these specs on its own initiative and runs them in its own CI, to exercise atago against a real program. They are not hugo’s official test suite, and the hugo project is not affiliated with atago.
Summary #
2 suites · 6 scenarios
Contents #
- hugo (scaffold + build CLI, tree-snapshot testbed) — 3 scenarios
- hugo server (suite-wide service + http peer) — 3 scenarios
hugo (scaffold + build CLI, tree-snapshot testbed) #
Source: test/e2e/thirdparty/hugo/hugo.atago.yaml
Scenario: new site scaffolds the documented directory tree #
only when hugo version succeeds
When #
hugo new site mysite
Then #
- exit code is
0 - stdout contains
Congratulations - dir
mysitecontainsarchetypes, containscontent, containslayouts, containsstatic, containsthemes - file
mysite/hugo.tomlcontainsbaseURL
Scenario: new content plus a minimal layout builds the public tree #
only when hugo version succeeds
Given #
- Fixture file
mysite/layouts/home.htmlis created. - Fixture file
mysite/layouts/single.htmlis created. - Fixture file
mysite/layouts/list.htmlis created.
Inputs #
Fixture mysite/layouts/home.html:
<!DOCTYPE html><html><body><h1>HOME</h1>{{ range site.RegularPages }}<a href="{{ .RelPermalink }}">{{ .Title }}</a>{{ end }}</body></html>
Fixture mysite/layouts/single.html:
<!DOCTYPE html><html><body><article><h1>{{ .Title }}</h1>{{ .Content }}</article></body></html>
Fixture mysite/layouts/list.html:
<html><body>{{ range .Pages }}{{ .Title }}{{ end }}</body></html>
When #
hugo new site mysite --quiet
hugo new content posts/hello.md
hugo --minify --buildDrafts
Then #
- after
hugo new content posts/hello.md:- exit code is
0 - file
mysite/content/posts/hello.mdcontainsdraft
- exit code is
- after
hugo --minify --buildDrafts:- exit code is
0 - file
mysite/public/index.htmlcontainsHOME - file
mysite/public/index.htmlcontains/posts/hello/ - file
mysite/public/posts/hello/index.htmlcontains<h1>Hello</h1> - dir
mysite/publiccontainsindex.html, containssitemap.xml, containsposts/hello/index.html
- exit code is
Scenario: building outside a site directory fails with a config hint #
only when hugo version succeeds
When #
hugo
Then #
- exit code is not
0 - stderr matches
/(?i)config/
hugo server (suite-wide service + http peer) #
Source: test/e2e/thirdparty/hugo/hugo_server.atago.yaml
Scenario: the home page lists the post #
When #
# HTTP GET /
Then #
- HTTP status is
200 - body contains
HOME - body contains
/posts/hello/
Scenario: the post page renders its title #
When #
# HTTP GET /posts/hello/
Then #
- HTTP status is
200 - body contains
<h1>Hello</h1>
Scenario: an unknown path is a 404 #
When #
# HTTP GET /no/such/page/
Then #
- HTTP status is
404