mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-18 21:11:19 +02:00
Create a struct with all of Hugo's config options
Primary motivation is documentation, but it will also hopefully simplify the code. Also, * Lower case the default output format names; this is in line with the custom ones (map keys) and how it's treated all the places. This avoids doing `stringds.EqualFold` everywhere. Closes #10896 Closes #10620
This commit is contained in:
@@ -18,11 +18,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"github.com/gohugoio/hugo/hugofs"
|
||||
"github.com/gohugoio/hugo/media"
|
||||
|
||||
"github.com/spf13/afero"
|
||||
|
||||
"github.com/gohugoio/hugo/media"
|
||||
|
||||
"github.com/evanw/esbuild/pkg/api"
|
||||
|
||||
qt "github.com/frankban/quicktest"
|
||||
@@ -46,7 +45,7 @@ func TestOptionKey(t *testing.T) {
|
||||
func TestToBuildOptions(t *testing.T) {
|
||||
c := qt.New(t)
|
||||
|
||||
opts, err := toBuildOptions(Options{mediaType: media.JavascriptType})
|
||||
opts, err := toBuildOptions(Options{mediaType: media.Builtin.JavascriptType})
|
||||
|
||||
c.Assert(err, qt.IsNil)
|
||||
c.Assert(opts, qt.DeepEquals, api.BuildOptions{
|
||||
@@ -62,7 +61,7 @@ func TestToBuildOptions(t *testing.T) {
|
||||
Target: "es2018",
|
||||
Format: "cjs",
|
||||
Minify: true,
|
||||
mediaType: media.JavascriptType,
|
||||
mediaType: media.Builtin.JavascriptType,
|
||||
AvoidTDZ: true,
|
||||
})
|
||||
c.Assert(err, qt.IsNil)
|
||||
@@ -79,7 +78,7 @@ func TestToBuildOptions(t *testing.T) {
|
||||
})
|
||||
|
||||
opts, err = toBuildOptions(Options{
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.Builtin.JavascriptType,
|
||||
SourceMap: "inline",
|
||||
})
|
||||
c.Assert(err, qt.IsNil)
|
||||
@@ -97,7 +96,7 @@ func TestToBuildOptions(t *testing.T) {
|
||||
})
|
||||
|
||||
opts, err = toBuildOptions(Options{
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.Builtin.JavascriptType,
|
||||
SourceMap: "inline",
|
||||
})
|
||||
c.Assert(err, qt.IsNil)
|
||||
@@ -115,7 +114,7 @@ func TestToBuildOptions(t *testing.T) {
|
||||
})
|
||||
|
||||
opts, err = toBuildOptions(Options{
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.JavascriptType,
|
||||
Target: "es2018", Format: "cjs", Minify: true, mediaType: media.Builtin.JavascriptType,
|
||||
SourceMap: "external",
|
||||
})
|
||||
c.Assert(err, qt.IsNil)
|
||||
|
Reference in New Issue
Block a user