diff --git a/.changeset/brave-queens-crash.md b/.changeset/brave-queens-crash.md new file mode 100644 index 0000000000..c28e5975f3 --- /dev/null +++ b/.changeset/brave-queens-crash.md @@ -0,0 +1,5 @@ +--- +'@backstage/core-compat-api': patch +--- + +Make `convertLegacyApp` wrap discovered routes with `compatWrapper`. diff --git a/packages/core-compat-api/package.json b/packages/core-compat-api/package.json index 29f70aae68..f5de02c154 100644 --- a/packages/core-compat-api/package.json +++ b/packages/core-compat-api/package.json @@ -35,6 +35,7 @@ }, "devDependencies": { "@backstage/cli": "workspace:^", + "@backstage/frontend-app-api": "workspace:^", "@backstage/frontend-test-utils": "workspace:^", "@backstage/plugin-catalog": "workspace:^", "@backstage/plugin-puppetdb": "workspace:^", diff --git a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx index ed6807514d..240aa33e2c 100644 --- a/packages/core-compat-api/src/collectLegacyRoutes.test.tsx +++ b/packages/core-compat-api/src/collectLegacyRoutes.test.tsx @@ -32,6 +32,14 @@ import { Route, Routes } from 'react-router-dom'; import { collectLegacyRoutes } from './collectLegacyRoutes'; // eslint-disable-next-line @backstage/no-relative-monorepo-imports import { toInternalBackstagePlugin } from '../../frontend-plugin-api/src/wiring/createPlugin'; +import { + createPlugin, + createRoutableExtension, + createRouteRef, + useApp, +} from '@backstage/core-plugin-api'; +import { createSpecializedApp } from '@backstage/frontend-app-api'; +import { render, screen } from '@testing-library/react'; describe('collectLegacyRoutes', () => { it('should collect legacy routes', () => { @@ -241,4 +249,34 @@ describe('collectLegacyRoutes', () => { }, ]); }); + + it('should make legacy APIs available', async () => { + const plugin = createPlugin({ + id: 'test', + }); + const routeRef = createRouteRef({ id: 'test' }); + const Page = plugin.provide( + createRoutableExtension({ + name: 'Test', + mountPoint: routeRef, + component: () => + Promise.resolve(() => { + const app = useApp(); + return