Rework the build.writeStats struct

Mostly to make it easier to toggle on/off this feature from the env.

See #11191
This commit is contained in:
Bjørn Erik Pedersen
2023-07-02 11:02:47 +02:00
parent c1eac616d5
commit 5afc89f2bf
6 changed files with 40 additions and 59 deletions

View File

@@ -138,11 +138,7 @@ func TestClassCollector(t *testing.T) {
c.Run(fmt.Sprintf("%s--minify-%t", test.name, variant.minify), func(c *qt.C) {
w := newHTMLElementsCollectorWriter(newHTMLElementsCollector(
config.WriteStats{
Tags: true,
Classes: true,
IDs: true,
},
config.BuildStats{Enable: true},
))
if variant.minify {
if skipMinifyTest[test.name] {
@@ -248,11 +244,7 @@ func BenchmarkElementsCollectorWriter(b *testing.B) {
`
for i := 0; i < b.N; i++ {
w := newHTMLElementsCollectorWriter(newHTMLElementsCollector(
config.WriteStats{
Tags: true,
Classes: true,
IDs: true,
},
config.BuildStats{Enable: true},
))
fmt.Fprint(w, benchHTML)
@@ -276,11 +268,7 @@ func BenchmarkElementsCollectorWriterPre(b *testing.B) {
`
w := newHTMLElementsCollectorWriter(newHTMLElementsCollector(
config.WriteStats{
Tags: true,
Classes: true,
IDs: true,
},
config.BuildStats{Enable: true},
))
for i := 0; i < b.N; i++ {
fmt.Fprint(w, benchHTML)