Skip to content

Deprecate old testing framework in favor of createTester#10964

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

Deprecate old testing framework in favor of createTester#10964
Copilot wants to merge 6 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: 0e966be

@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.

@github-actions

Copy link
Copy Markdown
Contributor

❌ There is undocummented changes. Run chronus add to add a changeset or click here.

The following packages have changes but are not documented.

  • @typespec/emitter-framework
  • @typespec/http-client-js
  • @typespec/http-client
  • @typespec/http-server-js

The following packages have already been documented:

  • @typespec/compiler
  • @typespec/events
  • @typespec/html-program-viewer
  • @typespec/http
  • @typespec/json-schema
  • @typespec/library-linter
  • @typespec/rest
  • @typespec/sse
  • @typespec/streams
  • @typespec/versioning
  • @typespec/xml
Show changes

@typespec/compiler - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/http - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/rest - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/versioning - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/json-schema - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/xml - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/events - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/sse - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/streams - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/html-program-viewer - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@typespec/library-linter - deprecation ✏️

Deprecate old testing framework (createTestHost, createTestRunner, createTestWrapper, createTestLibrary, BasicTestRunner, TypeSpecTestLibrary, etc.). Use createTester from @typespec/compiler/testing instead.

@timotheeguerin

Copy link
Copy Markdown
Member

@copilot fix lint issues

/home/runner/work/typespec/typespec/packages/compiler/src/testing/code-fix-testing.ts
Warning:   51:24  warning  `createTestHost` is deprecated. Use {@link createTester }  @typescript-eslint/no-deprecated
Warning:   93:24  warning  `createTestHost` is deprecated. Use {@link createTester }  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/fs.ts
Warning:   126:50  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/index.ts
Warning:   18:10  warning  `createTestHost` is deprecated. Use {@link createTester }               @typescript-eslint/no-deprecated
Warning:   18:26  warning  `createTestRunner` is deprecated. Use {@link createTester }             @typescript-eslint/no-deprecated
Warning:   20:3   warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   21:3   warning  `createTestWrapper` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   23:3   warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated
Warning:   26:8   warning  `TestWrapperOptions` is deprecated. Use {@link Tester } instead         @typescript-eslint/no-deprecated
Warning:   30:3   warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}             @typescript-eslint/no-deprecated
Warning:   39:3   warning  `TestFiles` is deprecated. Use {@link Tester}                           @typescript-eslint/no-deprecated
Warning:   40:3   warning  `TestHost` is deprecated. Use {@link Tester}                            @typescript-eslint/no-deprecated
Warning:   41:3   warning  `TestHostConfig` is deprecated. Use {@link Tester}                      @typescript-eslint/no-deprecated
Warning:   42:3   warning  `TestHostError` is deprecated. Use {@link Tester}                       @typescript-eslint/no-deprecated
Warning:   45:3   warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:   46:3   warning  `TypeSpecTestLibraryInit` is deprecated. Use {@link Tester}             @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/rule-tester.ts
Warning:    72:11  warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}  @typescript-eslint/no-deprecated
Warning:   224:37  warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}  @typescript-eslint/no-deprecated
Warning:   224:82  warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/test-compiler-host.ts
Warning:     9:35  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}  @typescript-eslint/no-deprecated
Warning:    47:19  warning  `TestHostError` is deprecated. Use {@link Tester}        @typescript-eslint/no-deprecated
Warning:    55:19  warning  `TestHostError` is deprecated. Use {@link Tester}        @typescript-eslint/no-deprecated
Warning:   103:19  warning  `TestHostError` is deprecated. Use {@link Tester}        @typescript-eslint/no-deprecated
Warning:   135:17  warning  `TestHostError` is deprecated. Use {@link Tester}        @typescript-eslint/no-deprecated
ESLint found too many warnings (maximum: 0).

/home/runner/work/typespec/typespec/packages/compiler/src/testing/test-host.ts
Warning:   15:46  warning  `TestHostConfig` is deprecated. Use {@link Tester}                    @typescript-eslint/no-deprecated
Warning:   15:76  warning  `TestHost` is deprecated. Use {@link Tester}                          @typescript-eslint/no-deprecated
Warning:   27:47  warning  `TestHost` is deprecated. Use {@link Tester}                          @typescript-eslint/no-deprecated
Warning:   27:66  warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}           @typescript-eslint/no-deprecated
Warning:   28:35  warning  `createTestHost` is deprecated. Use {@link createTester }             @typescript-eslint/no-deprecated
Warning:   29:10  warning  `createTestWrapper` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated
Warning:   32:50  warning  `TestHost` is deprecated. Use {@link Tester}                          @typescript-eslint/no-deprecated
Warning:   34:20  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}               @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/test-utils.ts
Warning:   36:41  warning  `TypeSpecTestLibraryInit` is deprecated. Use {@link Tester}      @typescript-eslint/no-deprecated
Warning:   36:67  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}          @typescript-eslint/no-deprecated
Warning:   77:9   warning  `TestHost` is deprecated. Use {@link Tester}                     @typescript-eslint/no-deprecated
Warning:   78:23  warning  `TestWrapperOptions` is deprecated. Use {@link Tester } instead  @typescript-eslint/no-deprecated
Warning:   79:4   warning  `BasicTestRunner` is deprecated. Use {@link TesterInstance}      @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/compiler/src/testing/types.ts
Warning:    41:35  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}  @typescript-eslint/no-deprecated
Warning:   236:14  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}  @typescript-eslint/no-deprecated
Warning:   273:10  warning  `TestFiles` is deprecated. Use {@link Tester}            @typescript-eslint/no-deprecated
Warning:   278:15  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/events/src/testing/index.ts
Warning:   4:34  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   6:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/html-program-viewer/src/testing/index.ts
Warning:    8:40  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:62  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   11:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/http-server-js/src/testing/index.ts
Warning:    8:47  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:69  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/http/src/testing/index.ts
Warning:    8:31  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:53  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/json-schema/src/testing/index.ts
Warning:    8:37  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:59  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/library-linter/src/testing/index.ts
Warning:    8:40  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:62  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/openapi/src/testing/index.ts
Warning:    8:34  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:56  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/openapi3/src/testing/index.ts
Warning:    8:35  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:57  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/rest/src/testing/index.ts
Warning:    8:31  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:53  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/sse/src/testing/index.ts
Warning:   4:31  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   6:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/streams/src/testing/index.ts
Warning:   4:35  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   6:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/versioning/src/testing/index.ts
Warning:    8:37  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:59  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

/home/runner/work/typespec/typespec/packages/xml/src/testing/index.ts
Warning:    8:30  warning  `TypeSpecTestLibrary` is deprecated. Use {@link Tester}                 @typescript-eslint/no-deprecated
Warning:    8:52  warning  `createTestLibrary` is deprecated. Use {@link createTester } instead    @typescript-eslint/no-deprecated
Warning:   10:22  warning  `findTestPackageRoot` is deprecated. Use {@link createTester } instead  @typescript-eslint/no-deprecated

…mentation files

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

Copilot AI commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@copilot fix lint issues

/home/runner/work/typespec/typespec/packages/compiler/src/testing/code-fix-testing.ts

...

Fixed — added /* eslint-disable @typescript-eslint/no-deprecated */ to the top of all affected files (the compiler testing implementation files and the per-package XxxTestLibrary definition files). These files are the implementations of the deprecated functionality, so they legitimately need to reference those deprecated types internally.

@microsoft-github-policy-service microsoft-github-policy-service Bot added lib:openapi emitter:openapi3 Issues for @typespec/openapi3 emitter labels Jun 26, 2026
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:openapi3 Issues for @typespec/openapi3 emitter emitter-framework Issues for the emitter framework lib:http lib:openapi 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