Skip to content

Add unit tests for EsbuildCompressor #313

Description

@bjagg

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/:

  1. compressJavaScript with a simple JS input — output is smaller than input when esbuild is available
  2. compressCss with a simple CSS input — same
  3. Fallback path when npx is not on PATH (mock via ProcessBuilder or a test shim)
  4. Timeout handling (long-running esbuild call)
  5. Non-zero exit code handling (invalid JS input)
  6. 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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions