In the test below, the layout specified in front matter does not exist, so I would expect it to fallback to layouts/single.html. It intermittently falls back to layouts/list.html instead.
func TestIssue13628(t *testing.T) {
t.Parallel()
files := `
-- hugo.toml --
disableKinds = ['home','rss','sitemap','taxonomy','term']
-- content/p1.md --
---
title: p1
layout: foo
---
-- layouts/single.html --
layouts/single.html
-- layouts/list.html --
layouts/list.html
`
b := hugolib.Test(t, files)
b.AssertFileContent("public/p1/index.html", "layouts/single.html")
}
EDIT: There's something intermittent happening here.