diff --git a/.github/workflows/browser-tests.yml b/.github/workflows/browser-tests.yml index b9191641..c74c7f4c 100644 --- a/.github/workflows/browser-tests.yml +++ b/.github/workflows/browser-tests.yml @@ -40,10 +40,18 @@ jobs: - name: Verify a Chrome/Chromium binary is available # chromedp (used by the browsertest-tagged tests) discovers Chrome on # PATH or in a standard install location; GitHub's ubuntu-latest - # runner image ships Google Chrome preinstalled. Fail fast with a - # clear message here instead of a cryptic chromedp allocator error - # if that image ever stops including it. + # runner image ships Google Chrome preinstalled. Fail fast here with a + # clear message instead of a cryptic chromedp allocator error if that + # image ever stops including it. run: google-chrome --version - name: Run browser-level player compatibility tests run: make test-browser + + - name: Set up Node + uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + with: + node-version: '24' + + - name: Run frontend unit tests + run: make test-frontend diff --git a/Makefile b/Makefile index 3bc3e361..38814782 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -.PHONY: all build build-cli test test-coverage test-browser test-http-client test-http-client-rotate check fmt vet lint clean dev help screenshots build-stockholm-image prepare-stockholm update-static-deps dev-docs dev-docs-tidy hugo +.PHONY: all build build-cli test test-coverage test-browser test-frontend test-http-client test-http-client-rotate check fmt vet lint clean dev help screenshots build-stockholm-image prepare-stockholm update-static-deps dev-docs dev-docs-tidy hugo # Load .env if present (simple KEY=VALUE format, no shell quoting) -include .env @@ -156,6 +156,14 @@ test-browser: @echo "Running browser-level compatibility tests..." $(GOTEST) -tags browsertest -v ./pkg/service/soundtouchweb/... +# Unit tests for the embedded player's static JS modules (see +# pkg/service/soundtouchweb/frontend_test/), run via Node's built-in test +# runner. Not part of `test`/`check`, since they need a Node binary matching +# package.json's engines field, same reasoning as test-browser needing Chrome. +test-frontend: + @echo "Running frontend unit tests..." + node --test pkg/service/soundtouchweb/frontend_test/*.test.mjs + check: fmt vet test test-http-client # Archive any existing tests/integration/testdata/ to a timestamped sibling @@ -516,6 +524,7 @@ help: @echo " test - Run tests" @echo " test-coverage - Run tests with coverage report" @echo " test-browser - Run browser-level (chromedp) player compatibility tests" + @echo " test-frontend - Run player static JS unit tests (Node's test runner)" @echo " test-http-client - Run .http integration tests via Docker Compose" @echo " test-http-client-rotate - Archive tests/integration/testdata/ before a fresh run (non-destructive)" @echo " check - Run fmt, vet, and tests"