diff --git a/plugins/catalog-backend/package.json b/plugins/catalog-backend/package.json index 3220ec5fd1..38421af123 100644 --- a/plugins/catalog-backend/package.json +++ b/plugins/catalog-backend/package.json @@ -107,7 +107,7 @@ "@types/supertest": "^2.0.8", "better-sqlite3": "^12.0.0", "luxon": "^3.0.0", - "msw": "^1.0.0", + "msw": "^2.0.0", "supertest": "^7.0.0", "wait-for-expect": "^3.0.2", "winston": "^3.13.0" diff --git a/plugins/catalog-backend/src/processors/UrlReaderProcessor.test.ts b/plugins/catalog-backend/src/processors/UrlReaderProcessor.test.ts index 0b17ecb19f..b279e98ec2 100644 --- a/plugins/catalog-backend/src/processors/UrlReaderProcessor.test.ts +++ b/plugins/catalog-backend/src/processors/UrlReaderProcessor.test.ts @@ -18,8 +18,8 @@ import { mockServices, registerMswTestHooks, } from '@backstage/backend-test-utils'; -import { rest } from 'msw'; import { setupServer } from 'msw/node'; +import { HttpResponse, http } from 'msw'; import { CatalogProcessorCache, CatalogProcessorEntityResult, @@ -61,13 +61,15 @@ describe('UrlReaderProcessor', () => { }; server.use( - rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) => - res( - ctx.set({ ETag: 'my-etag' }), - ctx.json({ + http.get(`${mockApiOrigin}/component.yaml`, () => + HttpResponse.json( + { kind: 'component', metadata: { name: 'mock-url-entity' }, - }), + }, + { + headers: { ETag: 'my-etag' }, + }, ), ), ); @@ -115,8 +117,8 @@ describe('UrlReaderProcessor', () => { }), }); server.use( - rest.get(`${mockApiOrigin}/component.yaml`, (_, res, ctx) => - res(ctx.status(304)), + http.get(`${mockApiOrigin}/component.yaml`, () => + HttpResponse.json(null, { status: 304 }), ), ); const spec = { @@ -171,8 +173,8 @@ describe('UrlReaderProcessor', () => { }; server.use( - rest.get(`${mockApiOrigin}/component-notfound.yaml`, (_, res, ctx) => { - return res(ctx.status(404)); + http.get(`${mockApiOrigin}/component-notfound.yaml`, () => { + return HttpResponse.json(null, { status: 404 }); }), ); diff --git a/yarn.lock b/yarn.lock index a3334417ab..912e9a7f56 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4719,7 +4719,7 @@ __metadata: lodash: "npm:^4.17.21" luxon: "npm:^3.0.0" minimatch: "npm:^9.0.0" - msw: "npm:^1.0.0" + msw: "npm:^2.0.0" p-limit: "npm:^3.0.2" prom-client: "npm:^15.0.0" supertest: "npm:^7.0.0"