-
Notifications
You must be signed in to change notification settings - Fork 65
fix: Build web dashboard assets before Go compilation #107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -3,18 +3,22 @@ package webserver | |||||||||||
| import ( | ||||||||||||
| "context" | ||||||||||||
| "encoding/json" | ||||||||||||
| "errors" | ||||||||||||
| "fmt" | ||||||||||||
| "io" | ||||||||||||
| "io/fs" | ||||||||||||
| "log/slog" | ||||||||||||
| "net" | ||||||||||||
| "net/http" | ||||||||||||
| "net/http/httptest" | ||||||||||||
| "os" | ||||||||||||
| "path/filepath" | ||||||||||||
| "regexp" | ||||||||||||
| "runtime" | ||||||||||||
| "testing" | ||||||||||||
| "time" | ||||||||||||
|
|
||||||||||||
| "github.com/microsoft/waza/web" | ||||||||||||
| "github.com/stretchr/testify/assert" | ||||||||||||
| "github.com/stretchr/testify/require" | ||||||||||||
| ) | ||||||||||||
|
|
@@ -129,6 +133,97 @@ func TestWebSocketUpgradeRequestFallsBackToSPA(t *testing.T) { | |||||||||||
| assert.Contains(t, string(body), "<!doctype html>") | ||||||||||||
| } | ||||||||||||
|
|
||||||||||||
| // TestEmbeddedAssetsDirectoryContainsBundles verifies that the embedded | ||||||||||||
| // web/dist filesystem includes at least one JS and one CSS bundle inside | ||||||||||||
| // the assets/ subdirectory. A missing assets/ directory (or empty one) is | ||||||||||||
| // exactly the bug that caused the blank-page issue. | ||||||||||||
| func TestEmbeddedAssetsDirectoryContainsBundles(t *testing.T) { | ||||||||||||
| distFS, err := fs.Sub(web.Assets, "dist") | ||||||||||||
| require.NoError(t, err, "fs.Sub for dist should succeed") | ||||||||||||
|
|
||||||||||||
| entries, err := fs.ReadDir(distFS, "assets") | ||||||||||||
| if errors.Is(err, fs.ErrNotExist) { | ||||||||||||
| t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web')") | ||||||||||||
|
||||||||||||
| t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web')") | |
| if os.Getenv("WAZA_SKIP_WEB_ASSET_TESTS") != "" { | |
| t.Skip("skipping: web/dist/assets not built (run 'cd web && npm run build' or 'make build-web'; set WAZA_SKIP_WEB_ASSET_TESTS='' to enforce failure)") | |
| } | |
| require.FailNow(t, "web/dist/assets not built (run 'cd web && npm run build' or 'make build-web'; or set WAZA_SKIP_WEB_ASSET_TESTS=1 to skip this test)") |
Copilot
AI
Mar 10, 2026
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above: t.Skip when dist/assets doesn’t exist means this check won’t enforce the embed/build invariant in setups that don’t build the web UI first. If this is intended to prevent regressions in packaging, it should fail by default (or at least fail under CI) so missing bundles are surfaced.
Uh oh!
There was an error while loading. Please reload this page.