30 lines
631 B
Go
30 lines
631 B
Go
//go:build !dev
|
|
|
|
package frontend
|
|
|
|
import (
|
|
"io/fs"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestReleaseEmbedsEveryBuiltAsset(t *testing.T) {
|
|
// Check the build output itself, including Vite's __vite-* chunks. Missing
|
|
// optional gzip files are valid; missing originals in the binary are not.
|
|
err := fs.WalkDir(os.DirFS("."), "dist", func(path string, entry fs.DirEntry, err error) error {
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if entry.IsDir() {
|
|
return nil
|
|
}
|
|
if _, err := fs.Stat(Assets(), path); err != nil {
|
|
t.Errorf("asset absent from release binary: %s: %v", path, err)
|
|
}
|
|
return nil
|
|
})
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|