Context
PR #303 added EsbuildCompressor.java, a new class that forks npx esbuild to minify JavaScript and CSS streams. The class has no direct unit test coverage.
Why it matters
Proposed tests
Unit tests under resource-server-core/src/test/java/org/jasig/resource/aggr/:
compressJavaScript with a simple JS input — output is smaller than input when esbuild is available
compressCss with a simple CSS input — same
- Fallback path when
npx is not on PATH (mock via ProcessBuilder or a test shim)
- Timeout handling (long-running esbuild call)
- Non-zero exit code handling (invalid JS input)
- Temp file cleanup on success and failure paths
Tests should be skipped or marked conditional if Node is not available on the test runner, so CI without Node still passes.
Priority
Low — existing aggregator integration tests provide some coverage indirectly. Filing as a follow-up to PR #303.
Context
PR #303 added
EsbuildCompressor.java, a new class that forksnpx esbuildto minify JavaScript and CSS streams. The class has no direct unit test coverage.Why it matters
ProcessBuilderand handles timeouts, exit codes, stderr output, and temp file cleanup — all error-proneProposed tests
Unit tests under
resource-server-core/src/test/java/org/jasig/resource/aggr/:compressJavaScriptwith a simple JS input — output is smaller than input when esbuild is availablecompressCsswith a simple CSS input — samenpxis not on PATH (mock viaProcessBuilderor a test shim)Tests should be skipped or marked conditional if Node is not available on the test runner, so CI without Node still passes.
Priority
Low — existing aggregator integration tests provide some coverage indirectly. Filing as a follow-up to PR #303.