Skip to content

Commit 32ff9cc

Browse files
xirzecCopilot
andauthored
Unify typespec-ts coverage and migrate spector upload into this repo (#4750)
## Summary RLC support for the TypeScript emitter has been dropped, and the emitter (`@azure-tools/typespec-ts`) now lives in this repo (migrated from the now-deprecated `Azure/autorest.typescript`). This PR unifies the dashboard presentation and brings the coverage upload home. ### Website (`can-i-use/http.astro`) - Collapsed the two TypeScript rows (RLC + Modular) into a single `@azure-tools/typespec-ts` entry in both the data-plane and management-plane emitter lists. - Renamed the displayed language flavor from "TypeScript (Modular)" / "TypeScript (RLC)" to **"JavaScript"**. ### Coverage upload (`eng/pipelines/jobs/build-for-publish.yml`) The spector coverage upload for typespec-ts previously ran only in `Azure/autorest.typescript` (`.scripts/ci.yml`, branch `v6`), uploading `@azure-tools/typespec-ts-modular` and `@azure-tools/typespec-ts-rlc`. That job was never migrated when the emitter moved here. This adds a parallel upload mirroring the existing Python block: - Runs `pnpm run test:ts:e2e` in `packages/typespec-ts`. - Uploads the resulting coverage via `tsp-spector upload-coverage` under the unified generator name `@azure-tools/typespec-ts` (mode `azure`), using the same storage account / `coverages` container convention as the other emitters. ### Cleanup - Dropped `modular` from the generated coverage file name (`spector-coverage-typescript-azure.json`). ## Notes / follow-ups - **Data gap:** the dashboard's JavaScript column will be empty until the next publish build runs on `main` and produces the first `@azure-tools/typespec-ts` coverage blob. - **Retire old job:** once this lands, the `@azure-tools/typespec-ts-modular` / `-rlc` upload in `Azure/autorest.typescript` `.scripts/ci.yml` can be removed. - **Standard mode:** only the `azure`-mode upload is wired, since the dashboard renders `modes: ["azure"]` and the repo's `integration-test-ci` only runs the azure-modular server. Standard-mode parity can be added later if desired. --------- Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent a351bf4 commit 32ff9cc

7 files changed

Lines changed: 55 additions & 34 deletions

File tree

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
changeKind: internal
3+
packages:
4+
- "@azure-tools/typespec-ts"
5+
---
6+
7+
Simplify the test/spector npm scripts now that the TypeScript emitter only produces a single unified (Azure modular) output: drop the redundant `:azure-modular`/`:modular` script-name suffixes and pass-through aliases, remove the dead non-Azure `start-test-server` and the unused `test:azure`/`test:ts:e2e`/`integration-test-ci:sequential` scripts, and rename the spector coverage file to drop `modular` from its name.

.github/instructions/typespec-ts.instructions.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ The package is tested through vitest projects (see `vitest.config.ts`):
3535
- `integration-azure-modular``test/azure-modular-integration/**` (Modular spector e2e).
3636

3737
Run them with `pnpm test-next`, `pnpm unit-test` (runs the modular unit project),
38-
and `pnpm integration-test-ci:azure-modular`.
38+
and `pnpm integration-test-ci`.
3939
There is intentionally no non-Azure integration project — coverage for those scenarios
4040
is a superset within the `azure-*` folders.
4141

@@ -81,7 +81,7 @@ Integration (spector) tests generate real clients from specs, then assert on the
8181
subprocess per compile.
8282
- `--phase=declarations` emits the tracked `src/index.d.ts` baseline (tsc `.d.ts` +
8383
api-extractor rollup). Only `check:tree` consumes these, so the e2e script
84-
`generate-and-run:azure-modular` runs the vitest suite in parallel with the
84+
`generate-and-run` runs the vitest suite in parallel with the
8585
declaration regen, keeping the (slow) api-extractor work off the test critical path.
8686
3. The vitest `integration-azure-modular` project then runs the `*.test.ts` assertions.
8787

@@ -100,7 +100,7 @@ must run before `check:tree`.
100100

101101
## CI: `e2e-test` job in `.github/workflows/ci-typescript.yml`
102102

103-
The e2e job runs `copy:typespec``integration-test-ci:azure-modular`
103+
The e2e job runs `copy:typespec``spector-test`
104104
`pnpm check:tree`. `check:tree`
105105
(`test/commands/check-clean-tree.ts`) **fails if regeneration leaves the git tree dirty**.
106106
So a baseline that doesn't match freshly generated output (changed, missing, or added

.github/workflows/ci-typescript.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ jobs:
5858
- name: Copy TypeSpec files
5959
working-directory: packages/typespec-ts
6060
run: pnpm copy:typespec
61-
- name: Run Modular Spector tests
61+
- name: Run Spector tests
6262
working-directory: packages/typespec-ts
63-
run: pnpm integration-test-ci:azure-modular
63+
run: pnpm spector-test
6464
- name: Check git tree is clean
6565
working-directory: packages/typespec-ts
6666
run: pnpm check:tree

eng/pipelines/jobs/build-for-publish.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,30 @@ jobs:
4141
PackagePath: packages/typespec-python
4242
GeneratorName: "@azure-tools/typespec-python"
4343

44+
# TypeScript (typespec-ts) e2e tests and spector coverage upload.
45+
# The emitter was migrated here from Azure/autorest.typescript; this replaces
46+
# the coverage upload that previously ran in that (now deprecated) repo.
47+
- script: pnpm run integration-test-ci
48+
displayName: "Run TypeScript e2e tests"
49+
workingDirectory: packages/typespec-ts
50+
51+
- task: AzureCLI@2
52+
displayName: "Upload spector coverage (typespec-ts, azure)"
53+
continueOnError: true
54+
inputs:
55+
azureSubscription: "TypeSpec Storage"
56+
scriptType: "bash"
57+
scriptLocation: "inlineScript"
58+
inlineScript: >-
59+
npx tsp-spector upload-coverage
60+
--coverageFile ./coverage/spector-coverage-typescript-azure.json
61+
--generatorName "@azure-tools/typespec-ts"
62+
--storageAccountName typespec
63+
--containerName coverages
64+
--generatorVersion $(node -p -e "require('./package.json').version")
65+
--generatorMode azure
66+
workingDirectory: packages/typespec-ts
67+
4468
- template: /eng/pipelines/templates/pack.yml
4569
parameters:
4670
artifactName: npm-packages-stable

packages/typespec-ts/CONTRIBUTING.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,16 @@ the required tooling (Node.js and `pnpm`). The command scripts under `test/comma
3636

3737
The package is tested through three vitest projects (configured in `vitest.config.ts`):
3838

39-
| Project | Location | Covers | Command |
40-
| --------------------------- | ----------------------------------- | -------------------------------- | ---------------------------------------- |
41-
| `test-next` | `test-next/**` | Modern unit tests | `pnpm test-next` |
42-
| `unit-modular` | `test/modular-unit/**` | Modular unit tests | `pnpm unit-test` |
43-
| `integration-azure-modular` | `test/azure-modular-integration/**` | Modular spector end-to-end tests | `pnpm integration-test-ci:azure-modular` |
39+
| Project | Location | Covers | Command |
40+
| --------------------------- | ----------------------------------- | -------------------------------- | -------------------------- |
41+
| `test-next` | `test-next/**` | Modern unit tests | `pnpm test-next` |
42+
| `unit-modular` | `test/modular-unit/**` | Modular unit tests | `pnpm unit-test` |
43+
| `integration-azure-modular` | `test/azure-modular-integration/**` | Modular spector end-to-end tests | `pnpm integration-test-ci` |
4444

4545
`pnpm lint` runs ESLint with `--max-warnings=0`.
4646

4747
The integration suite generates real clients from specs and runs them against a local spector
48-
test server; `pnpm integration-test-ci:azure-modular` starts the server, generates, and runs the
48+
test server; `pnpm integration-test-ci` starts the server, generates, and runs the
4949
assertions for you. To (re)generate the tracked baselines without running the tests:
5050

5151
```bash
@@ -96,7 +96,7 @@ pnpm check:tree # fails if regeneration left the git tree dirty
9696

9797
```bash
9898
pnpm copy:typespec
99-
pnpm generate-tsp-only:azure-modular:client
99+
pnpm generate-tsp-only:client
100100
```
101101

102102
Once your change is complete, regenerate the whole suite and verify there are no unexpected

packages/typespec-ts/package.json

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -20,28 +20,21 @@
2020
"clean": "rimraf ./dist ./typespec-output",
2121
"build": "tsc -p .",
2222
"test": "npm run test-next && npm run unit-test && npm run integration-test-ci",
23-
"test:azure": "npm run test-next && npm run copy:typespec && npm run integration-test-ci:azure-modular",
2423
"lint": "eslint . --ext .ts --max-warnings=0",
2524
"lint:fix": "eslint . --fix --ext .ts",
2625
"check:tree": "node ./test/commands/check-clean-tree.ts",
27-
"test:ts:e2e": "npm run copy:typespec && npm run integration-test-ci:azure-modular",
28-
"integration-test-ci": "npm-run-all copy:typespec integration-test-ci:azure-modular",
29-
"integration-test-ci:sequential": "npm-run-all --serial copy:typespec integration-test-ci:azure-modular",
30-
"integration-test-ci:azure-modular": "npm-run-all --silent -p start-test-server:azure-modular --race generate-and-run:azure-modular",
31-
"start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@typespec/http-specs/specs --coverageFile ./coverage/spector-coverage-typescript.json",
32-
"start-test-server:azure-modular": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-modular-azure.json",
26+
"integration-test-ci": "npm-run-all copy:typespec spector-test",
27+
"spector-test": "npm-run-all --silent -p start-test-server --race generate-and-run",
28+
"start-test-server": "mkdirp -p coverage && npx tsp-spector serve ./node_modules/@azure-tools/azure-http-specs/specs ./node_modules/@typespec/http-specs/specs --port 3002 --coverageFile ./coverage/spector-coverage-typescript-azure.json",
3329
"copy:typespec": "node ./test/commands/copy-typespec.ts",
34-
"generate-and-run:azure-modular": "npm run generate-tsp-only:azure-modular:client && npm-run-all -p integration-test:alone:azure-modular generate-tsp-only:azure-modular:declarations && npm run stop-test-server -- -p 3002",
35-
"generate-tsp-only": "npm run generate-tsp-only:azure-modular",
36-
"generate-tsp-only:azure-modular": "node ./test/commands/gen-spector.js",
37-
"generate-tsp-only:azure-modular:client": "node ./test/commands/gen-spector.js --phase=client",
38-
"generate-tsp-only:azure-modular:declarations": "node ./test/commands/gen-spector.js --phase=declarations",
30+
"generate-and-run": "npm run generate-tsp-only:client && npm-run-all -p integration-test:alone generate-tsp-only:declarations && npm run stop-test-server -- -p 3002",
31+
"generate-tsp-only": "node ./test/commands/gen-spector.js",
32+
"generate-tsp-only:client": "node ./test/commands/gen-spector.js --phase=client",
33+
"generate-tsp-only:declarations": "node ./test/commands/gen-spector.js --phase=declarations",
3934
"regen-test-baselines": "npm run generate-tsp-only",
40-
"integration-test:alone": "npm run integration-test:alone:azure-modular",
41-
"integration-test:alone:azure-modular": "vitest run --project integration-azure-modular",
35+
"integration-test:alone": "vitest run --project integration-azure-modular",
4236
"stop-test-server": "npx tsp-spector server stop",
43-
"unit-test": "npm run unit-test:modular",
44-
"unit-test:modular": "cross-env NODE_OPTIONS=--max-old-space-size=1024 vitest run --project unit-modular",
37+
"unit-test": "cross-env NODE_OPTIONS=--max-old-space-size=1024 vitest run --project unit-modular",
4538
"gen:scenario-suites": "node ./test/commands/gen-scenario-suites.ts",
4639
"regen-docs": "npm run build && tspd doc . --enable-experimental --output-dir ../../website/src/content/docs/docs/emitters/clients/typespec-ts/reference --skip-js"
4740
},

website/src/pages/can-i-use/http.astro

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@ const options: CoverageFromAzureStorageOptions = {
1616
"@azure-tools/typespec-python",
1717
"@azure-tools/typespec-go",
1818
"@azure-typespec/http-client-csharp",
19-
"@azure-tools/typespec-ts-rlc",
20-
"@azure-tools/typespec-ts-modular",
19+
"@azure-tools/typespec-ts",
2120
"@azure-tools/typespec-java",
2221
"@azure-tools/typespec-cpp",
2322
"@azure-tools/typespec-rust",
@@ -28,8 +27,7 @@ const options: CoverageFromAzureStorageOptions = {
2827
"@azure-tools/typespec-python": "Python",
2928
"@azure-tools/typespec-go": "Go",
3029
"@azure-typespec/http-client-csharp": "C#",
31-
"@azure-tools/typespec-ts-rlc": "TypeScript (RLC)",
32-
"@azure-tools/typespec-ts-modular": "TypeScript (Modular)",
30+
"@azure-tools/typespec-ts": "JavaScript",
3331
"@azure-tools/typespec-java": "Java",
3432
"@azure-tools/typespec-cpp": "C++",
3533
"@azure-tools/typespec-rust": "Rust",
@@ -47,8 +45,7 @@ const options: CoverageFromAzureStorageOptions = {
4745
"@azure-tools/typespec-python",
4846
"@azure-tools/typespec-go",
4947
"@azure-typespec/http-client-csharp-mgmt",
50-
"@azure-tools/typespec-ts-rlc",
51-
"@azure-tools/typespec-ts-modular",
48+
"@azure-tools/typespec-ts",
5249
"@azure-tools/typespec-java",
5350
"@azure-tools/typespec-cpp",
5451
"@azure-tools/typespec-rust",

0 commit comments

Comments
 (0)