Skip to content

Deprecate old testing framework in favor of createTester#10964

Draft
Copilot wants to merge 4 commits into
mainfrom
copilot/deprecate-old-testing-framework
Draft

Deprecate old testing framework in favor of createTester#10964
Copilot wants to merge 4 commits into
mainfrom
copilot/deprecate-old-testing-framework

Conversation

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Marks the legacy TypeSpec test host API as @deprecated now that all libraries have migrated to the new createTester-based framework.

Deprecated APIs

@typespec/compiler/testing

  • Functions: createTestHost, createTestRunner, createTestWrapper, createTestLibrary, findTestPackageRoot
  • Types: TestHost, BasicTestRunner, TypeSpecTestLibrary, TypeSpecTestLibraryInit, TestHostConfig, TestFiles, TestHostError, TestWrapperOptions

Per-package XxxTestLibrary exports — deprecated in: @typespec/http, @typespec/rest, @typespec/versioning, @typespec/json-schema, @typespec/xml, @typespec/events, @typespec/sse, @typespec/streams, @typespec/html-program-viewer, @typespec/library-linter, and several non-tracked packages.

Migration

- import { createTestHost, createTestWrapper } from "@typespec/compiler/testing";
- import { HttpTestLibrary } from "@typespec/http/testing";
-
- export async function createMyTestHost() {
-   return createTestHost({ libraries: [HttpTestLibrary] });
- }
- export async function createMyTestRunner() {
-   const host = await createMyTestHost();
-   return createTestWrapper(host, { autoUsings: ["TypeSpec.Http"] });
- }

+ import { resolvePath } from "@typespec/compiler";
+ import { createTester } from "@typespec/compiler/testing";
+
+ export const Tester = createTester(resolvePath(import.meta.dirname, ".."), {
+   libraries: ["@typespec/http"],
+ }).importLibraries().using("Http");

Templates

Removed src/testing/index.ts from the library-ts and emitter-ts scaffold templates — new projects no longer need to generate a XxxTestLibrary export since createTester accepts library names as strings directly.

Copilot AI linked an issue Jun 11, 2026 that may be closed by this pull request
…ports

- Mark createTestHost, createTestRunner as @deprecated in compiler testing
- Mark createTestWrapper, createTestLibrary, findTestPackageRoot as @deprecated
- Mark TestWrapperOptions, BasicTestRunner, TestHost, TypeSpecTestLibrary,
  TypeSpecTestLibraryInit, TestHostConfig, TestFiles, TestHostError as @deprecated
- Add @deprecated to all XxxTestLibrary exports across packages:
  LibraryLinterTestLibrary, RestTestLibrary, HttpTestLibrary, SSETestLibrary,
  JsonSchemaTestLibrary, StreamsTestLibrary, VersioningTestLibrary,
  HttpServerJavaScriptTestLibrary, EventsTestLibrary, XmlTestLibrary,
  EmitterFrameworkTestLibrary, ProgramViewerTestLibrary,
  HttpClientJavascriptEmitterTestLibrary, HttpClientTestLibrary
- Remove src/testing/index.ts from library-ts and emitter-ts templates
- Add chronus deprecation changelog entry

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
@microsoft-github-policy-service microsoft-github-policy-service Bot added compiler:core Issues for @typespec/compiler emitter-framework Issues for the emitter framework lib:http lib:rest labels Jun 11, 2026
@typespec/openapi and @typespec/openapi3 XxxTestLibrary exports were
already @deprecated before this PR, so they don't need changelog entries.

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>
Copilot AI changed the title [WIP] Deprecate old testing framework Deprecate old testing framework in favor of createTester Jun 11, 2026
Copilot AI requested a review from timotheeguerin June 11, 2026 13:32
@pkg-pr-new

pkg-pr-new Bot commented Jun 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@typespec/compiler

npm i https://pkg.pr.new/microsoft/typespec/@typespec/compiler@10964

@typespec/emitter-framework

npm i https://pkg.pr.new/microsoft/typespec/@typespec/emitter-framework@10964

@typespec/events

npm i https://pkg.pr.new/microsoft/typespec/@typespec/events@10964

@typespec/html-program-viewer

npm i https://pkg.pr.new/microsoft/typespec/@typespec/html-program-viewer@10964

@typespec/http

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http@10964

@typespec/http-client

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client@10964

@typespec/http-client-js

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-client-js@10964

@typespec/http-server-js

npm i https://pkg.pr.new/microsoft/typespec/@typespec/http-server-js@10964

@typespec/json-schema

npm i https://pkg.pr.new/microsoft/typespec/@typespec/json-schema@10964

@typespec/library-linter

npm i https://pkg.pr.new/microsoft/typespec/@typespec/library-linter@10964

@typespec/rest

npm i https://pkg.pr.new/microsoft/typespec/@typespec/rest@10964

@typespec/sse

npm i https://pkg.pr.new/microsoft/typespec/@typespec/sse@10964

@typespec/streams

npm i https://pkg.pr.new/microsoft/typespec/@typespec/streams@10964

@typespec/versioning

npm i https://pkg.pr.new/microsoft/typespec/@typespec/versioning@10964

@typespec/xml

npm i https://pkg.pr.new/microsoft/typespec/@typespec/xml@10964

commit: c329a7d

@timotheeguerin

Copy link
Copy Markdown
Member

@copilot fix build

git status --porcelain
ERROR: Files above were changed during PR validation, but not included in the PR.
M packages/compiler/templates/scaffolding.json
Include any automated changes such as sample output, spec.html, and ThirdPartyNotices.txt in your PR.

Co-authored-by: timotheeguerin <1031227+timotheeguerin@users.noreply.github.com>

Copilot AI commented Jun 11, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix build

git status --porcelain
ERROR: Files above were changed during PR validation, but not included in the PR.
...

Fixed in the latest commit — removed the library-ts/src/testing/index.ts.mu and emitter-ts/src/testing/index.ts.mu entries from packages/compiler/templates/scaffolding.json to match the deleted template files.

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

Labels

compiler:core Issues for @typespec/compiler emitter:client:js Issue for the JS client emitter: @typespec/http-client-js emitter:json-schema emitter-framework Issues for the emitter framework lib:http lib:rest lib:versioning ui:type-graph-viewer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Deprecate old testing framework

2 participants