From 861f162b4a39117b824669d67a951ed1db142e3d Mon Sep 17 00:00:00 2001 From: Johan Haals Date: Wed, 14 Aug 2024 15:17:03 +0200 Subject: [PATCH] backend-test-utils: Remove deprecations Co-authored-by: Camila Belo Signed-off-by: Johan Haals --- .changeset/late-timers-sort.md | 12 +++++ packages/backend-test-utils/api-report.md | 17 ------- packages/backend-test-utils/src/deprecated.ts | 45 ------------------- packages/backend-test-utils/src/index.ts | 1 - .../src/next/wiring/ServiceFactoryTester.ts | 11 ----- 5 files changed, 12 insertions(+), 74 deletions(-) create mode 100644 .changeset/late-timers-sort.md delete mode 100644 packages/backend-test-utils/src/deprecated.ts diff --git a/.changeset/late-timers-sort.md b/.changeset/late-timers-sort.md new file mode 100644 index 0000000000..1b5221721c --- /dev/null +++ b/.changeset/late-timers-sort.md @@ -0,0 +1,12 @@ +--- +'@backstage/backend-test-utils': minor +--- + +Removed these deprecated helpers: + +- `setupRequestMockHandlers` Use `CreateMockDirectoryOptions` instead. +- `CreateMockDirectoryOptions` Use `registerMswTestHooks` instead. + +Stopped exporting the deprecated and internal `isDockerDisabledForTests` helper. + +Removed `get` method from `ServiceFactoryTester` which is replaced by `getSubject` diff --git a/packages/backend-test-utils/api-report.md b/packages/backend-test-utils/api-report.md index 584fedb1f5..d3a80c419e 100644 --- a/packages/backend-test-utils/api-report.md +++ b/packages/backend-test-utils/api-report.md @@ -55,9 +55,6 @@ export interface CreateMockDirectoryOptions { mockOsTmpDir?: boolean; } -// @public @deprecated (undocumented) -export function isDockerDisabledForTests(): boolean; - // @public (undocumented) export namespace mockCredentials { export function limitedUser( @@ -143,9 +140,6 @@ export interface MockDirectoryContentOptions { shouldReadAsText?: boolean | ((path: string, buffer: Buffer) => boolean); } -// @public @deprecated (undocumented) -export type MockDirectoryOptions = CreateMockDirectoryOptions; - // @public (undocumented) export namespace mockServices { // (undocumented) @@ -475,10 +469,6 @@ export class ServiceFactoryTester< subject: ServiceFactory, options?: ServiceFactoryTesterOptions, ): ServiceFactoryTester; - // @deprecated - get( - ...args: 'root' extends TScope ? [] : [pluginId?: string] - ): Promise; getService< TGetService, TGetScope extends 'root' | 'plugin', @@ -508,13 +498,6 @@ export type ServiceMock = { : TService[Key]; }; -// @public @deprecated (undocumented) -export function setupRequestMockHandlers(worker: { - listen: (t: any) => void; - close: () => void; - resetHandlers: () => void; -}): void; - // @public (undocumented) export function startTestBackend( options: TestBackendOptions, diff --git a/packages/backend-test-utils/src/deprecated.ts b/packages/backend-test-utils/src/deprecated.ts deleted file mode 100644 index 9790580a9c..0000000000 --- a/packages/backend-test-utils/src/deprecated.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Copyright 2024 The Backstage Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import { registerMswTestHooks } from './msw'; -import { CreateMockDirectoryOptions } from './filesystem'; -import { isDockerDisabledForTests as _isDockerDisabledForTests } from './util'; - -/** - * @public - * @deprecated Use `CreateMockDirectoryOptions` from `@backstage/backend-test-utils` instead. - */ -export type MockDirectoryOptions = CreateMockDirectoryOptions; - -/** - * @public - * @deprecated Use `registerMswTestHooks` from `@backstage/backend-test-utils` instead. - */ -export function setupRequestMockHandlers(worker: { - listen: (t: any) => void; - close: () => void; - resetHandlers: () => void; -}): void { - registerMswTestHooks(worker); -} - -/** - * @public - * @deprecated This is an internal function and will no longer be exported from this package. - */ -export function isDockerDisabledForTests(): boolean { - return _isDockerDisabledForTests(); -} diff --git a/packages/backend-test-utils/src/index.ts b/packages/backend-test-utils/src/index.ts index 4124a861f4..d1d80bf387 100644 --- a/packages/backend-test-utils/src/index.ts +++ b/packages/backend-test-utils/src/index.ts @@ -20,7 +20,6 @@ * @packageDocumentation */ -export * from './deprecated'; export * from './cache'; export * from './database'; export * from './msw'; diff --git a/packages/backend-test-utils/src/next/wiring/ServiceFactoryTester.ts b/packages/backend-test-utils/src/next/wiring/ServiceFactoryTester.ts index e8530f89bf..83a6a42307 100644 --- a/packages/backend-test-utils/src/next/wiring/ServiceFactoryTester.ts +++ b/packages/backend-test-utils/src/next/wiring/ServiceFactoryTester.ts @@ -82,17 +82,6 @@ export class ServiceFactoryTester< this.#registry = registry; } - /** - * Returns the service instance for the subject. - * - * @deprecated Use `getSubject` instead. - */ - async get( - ...args: 'root' extends TScope ? [] : [pluginId?: string] - ): Promise { - return this.getSubject(...args); - } - /** * Returns the service instance for the subject. *