This folder holds the end-to-end (Spector + Maven/JUnit) tests for
@azure-tools/typespec-java (the branded Java emitter built in the parent
@azure-tools/typespec-java package (..)). It regenerates and tests the emitter
against the http-specs and azure-http-specs Spector suites and a set of local
TypeSpec sources under tsp/.
It is part of the @azure-tools/typespec-java workspace package — it has no
package.json of its own. Its npm scripts (regenerate, test:java:e2e,
spector-*) live in the parent ../package.json, and it consumes the emitter
directly from the workspace build (../dist + ../generator/.../emitter.jar),
resolved via tspconfig.yaml's local emitter path — no packed
.tgz.
Install Node.js 22 or above. (Verify by running node --version)
Install Java 11 or above. (Verify by running java --version)
Install Maven. (Verify by running mvn --version)
Run pnpm install at the repo root once to install workspace dependencies (spector,
http-specs, etc.).
Run from the parent (packages/typespec-java) folder:
pnpm run regenerateregenerate runs Generate.ps1, which builds the emitter
(pnpm build), then regenerates the SDK from the local tsp/ sources and the
http-specs/azure-http-specs specs into the (gitignored) src/main/java folder.
This takes a while.
From packages/typespec-java:
pnpm run test:java:e2eThis runs Spector-Tests.ps1: it starts the tsp-spector
mock server, runs the JUnit tests (mvn clean test) against the generated SDK, then
stops the server. It also writes tsp-spector-coverage-java.json.
To start/stop the mock server manually (for example to run individual tests from your
IDE), from packages/typespec-java:
pnpm run spector-start # or: pnpm run spector-serve (foreground)
pnpm run spector-stopThe hand-written JUnit tests under src/test/java and the local specs under tsp/
are synced from the unbranded test project in the core/ submodule
(core/packages/http-client-java/http-client-generator-test). Refresh them from
packages/typespec-java with:
pnpm run sync-testsThe Azure-specific customization classes under customization/ are hand-maintained
here and are not synced from core.
npx tsp compile <target.tsp>Useful for a quick check that a change to the emitter behaves as expected. Generated
code is written to tsp-output/ for inspection.
Peer/dependency versions are managed by the workspace catalog: / workspace:^
protocols in the parent package.json. Run pnpm install at the repo root to pick up
new versions.