Skip to content

Commit 55179c3

Browse files
committed
chore: bump Backstage to 1.51.1 and migrate test tooling
Backstage CLI 0.36 makes Jest a peer dependency and drops the bundled version, so tests, type-check and lint all broke. Add jest 30, jsdom 27, @jest/environment-jsdom-abstract and @types/jest as devDependencies, and extend transformIgnorePatterns for the rehype-raw chain pulled in by the newer core-components. Migrate msw 1 (EOL) to msw 2 to drop @mswjs/interceptors' vulnerable xmldom (5 high advisories) and stay compatible with Jest 30. catalog-react 3.0 and eslint-plugin 0.3 have no breaking changes affecting this plugin. Pin GitHub Actions to commit SHAs via pinact for supply-chain safety.
1 parent 1045e38 commit 55179c3

11 files changed

Lines changed: 4908 additions & 4444 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@ jobs:
1111
shell: nix develop --command bash {0}
1212
steps:
1313
- name: Checkout
14-
uses: actions/checkout@v4
14+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
1515

16-
- uses: DeterminateSystems/nix-installer-action@main
17-
- uses: DeterminateSystems/magic-nix-cache-action@main
18-
- uses: DeterminateSystems/flake-checker-action@main
16+
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
17+
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
18+
- uses: DeterminateSystems/flake-checker-action@3164002371bc90729c68af0e24d5aacf20d7c9f6 # v12
1919

2020
- name: Install dependencies
2121
run: yarn install --immutable

.github/workflows/release.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Checkout code
11-
uses: actions/checkout@v4
11+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
1212
with:
1313
fetch-depth: 2 # We only need the current and the previous commit
1414

@@ -34,12 +34,12 @@ jobs:
3434
contents: write
3535
steps:
3636
- name: Checkout
37-
uses: actions/checkout@v4
37+
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
3838
with:
3939
fetch-depth: 0
40-
- uses: DeterminateSystems/nix-installer-action@main
41-
- uses: DeterminateSystems/magic-nix-cache-action@main
42-
- uses: DeterminateSystems/flake-checker-action@main
40+
- uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
41+
- uses: DeterminateSystems/magic-nix-cache-action@908b263ff629f4cc17666315b7fd3ec127c6244d # v14
42+
- uses: DeterminateSystems/flake-checker-action@3164002371bc90729c68af0e24d5aacf20d7c9f6 # v12
4343
- name: Install dependencies
4444
run: |
4545
yarn install --immutable

.yarnrc.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
approvedGitRepositories:
2+
- "**"
3+
4+
enableScripts: true
5+
16
nodeLinker: node-modules

backstage.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
"version": "1.45.3"
2+
"version": "1.51.1"
33
}

flake.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

flake.nix

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,12 @@
3232
nodejs
3333
pre-commit
3434
typescript
35+
pinact
3536
yarn-berry
36-
(python3.withPackages (p: with p; [ gyp ]))
37-
]
38-
++ (with nodePackages; [
3937
typescript-language-server
4038
node-gyp
41-
]);
39+
(python3.withPackages (p: with p; [ gyp ]))
40+
];
4241
shellHook = ''
4342
pre-commit install
4443
'';

justfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ clean: install
3030
yarn clean
3131

3232
# Bumps dependencies
33-
bump:
33+
update:
3434
nix flake update
3535
nix develop --command yarn backstage-cli versions:bump
36+
nix develop --command pinact run -u
3637
nix develop --command pre-commit autoupdate
3738

3839
# Checks for unused dependencies

package.json

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,9 @@
2828
"@testing-library/react": "^16.0.0"
2929
},
3030
"dependencies": {
31-
"@backstage/core-components": "^0.18.3",
32-
"@backstage/core-plugin-api": "^1.12.0",
33-
"@backstage/plugin-catalog-react": "^1.21.3",
31+
"@backstage/core-components": "^0.18.10",
32+
"@backstage/core-plugin-api": "^1.12.6",
33+
"@backstage/plugin-catalog-react": "^3.0.0",
3434
"@mui/icons-material": "^5.16.0",
3535
"@mui/material": "^5.16.0",
3636
"react-use": "^17.2.4"
@@ -40,19 +40,21 @@
4040
"react-dom": "^16.13.1 || ^17.0.0 || ^18.0.0"
4141
},
4242
"devDependencies": {
43-
"@backstage/cli": "^0.34.5",
44-
"@backstage/config": "^1.3.6",
45-
"@backstage/dev-utils": "^1.1.17",
46-
"@backstage/eslint-plugin": "^0.2.0",
47-
"@backstage/test-utils": "^1.7.13",
43+
"@backstage/cli": "^0.36.2",
44+
"@backstage/config": "^1.3.8",
45+
"@backstage/dev-utils": "^1.1.23",
46+
"@backstage/eslint-plugin": "^0.3.0",
47+
"@backstage/test-utils": "^1.7.18",
4848
"@emotion/react": "^11.14.0",
4949
"@emotion/styled": "^11.14.1",
50+
"@jest/environment-jsdom-abstract": "^30.0.0",
5051
"@spotify/eslint-config-base": "^15.0.0",
5152
"@spotify/eslint-config-react": "^15.0.0",
5253
"@spotify/eslint-config-typescript": "^15.0.0",
5354
"@testing-library/dom": "^10.4.1",
5455
"@testing-library/jest-dom": "^6.5.0",
5556
"@testing-library/react": "^16.0.0",
57+
"@types/jest": "^30.0.0",
5658
"@types/react": "^18.0.0",
5759
"@types/react-dom": "^18.0.0",
5860
"@typescript-eslint/eslint-plugin": "8.48.1",
@@ -67,7 +69,9 @@
6769
"eslint-plugin-unused-imports": "^2.0.0",
6870
"express": "^5.2.1",
6971
"http-proxy-middleware": "^3.0.5",
70-
"msw": "^1.0.0",
72+
"jest": "^30.0.0",
73+
"jsdom": "^27.1.0",
74+
"msw": "^2.0.0",
7175
"react": "^18.0.0",
7276
"react-dom": "^18.0.0",
7377
"react-router-dom": "^6.0.0",
@@ -81,7 +85,7 @@
8185
"module": "./dist/index.esm.js",
8286
"jest": {
8387
"transformIgnorePatterns": [
84-
"node_modules/(?!react-use|@backstage|react-syntax-highlighter|style-loader|css-loader|d3-.*|react-markdown|vfile|vfile-message|unist-.*|unified|bail|is-plain-obj|trough|remark-.*|mdast-.*|micromark.*|decode-named-character-reference|character-entities|property-information|hast-.*|space-separated-tokens|comma-separated-tokens|web-namespaces|zwitch|html-void-elements|ccount|escape-string-regexp|trim-lines|remark-rehype|unist-util-.*|markdown-table|@react-hookz/web|yaml)"
88+
"node_modules/(?!react-use|@backstage|react-syntax-highlighter|style-loader|css-loader|d3-.*|react-markdown|vfile|vfile-message|unist-.*|unified|bail|is-plain-obj|trough|remark-.*|mdast-.*|micromark.*|decode-named-character-reference|character-entities|property-information|hast-.*|space-separated-tokens|comma-separated-tokens|web-namespaces|zwitch|html-void-elements|ccount|escape-string-regexp|trim-lines|remark-rehype|rehype-.*|hastscript|unist-util-.*|markdown-table|@react-hookz/web|yaml|msw|@mswjs/.*|@open-draft/.*|rettime|until-async|@bundled-es-modules/.*|strict-event-emitter|headers-polyfill|outvariant|is-node-process)"
8589
]
8690
}
8791
}

src/components/SysdigComponent/SysdigComponent.test.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616
import { SysdigComponent } from './SysdigComponent';
17-
import { rest } from 'msw';
17+
import { http, HttpResponse } from 'msw';
1818
import { setupServer } from 'msw/node';
1919
import { screen } from '@testing-library/react';
2020
import {
@@ -61,7 +61,7 @@ describe('SysdigComponent', () => {
6161
// setup mock response
6262
beforeEach(() => {
6363
server.use(
64-
rest.get('/*', (_, res, ctx) => res(ctx.status(200), ctx.json({}))),
64+
http.get('*', () => HttpResponse.json({})),
6565
);
6666
});
6767

src/infra/api/SysdigApiClient.test.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { setupRequestMockHandlers, TestApiProvider } from "@backstage/test-utils";
22
import { ConfigReader } from "@backstage/config";
33
import { ConfigApi, FetchApi } from "@backstage/core-plugin-api";
4-
import { rest } from "msw";
4+
import { http, HttpResponse } from "msw";
55
import { setupServer } from "msw/node";
66
import { SysdigApiClient } from "./SysdigApiClient";
77
import { API_PROXY_BASE_PATH, API_VULN_RUNTIME } from "../../lib";
@@ -23,13 +23,14 @@ describe("SysdigApiClient", () => {
2323
beforeEach(() => {
2424
jest.clearAllMocks();
2525
server.use(
26-
rest.get(
26+
http.get(
2727
`http://localhost:7007${API_PROXY_BASE_PATH}${API_VULN_RUNTIME}`,
28-
(req, res, ctx) => {
29-
if (req.url.searchParams.get("filters") === "test-filter") {
30-
return res(ctx.json({ data: [{ id: "1", name: "test-runtime-vuln" }] }));
28+
({ request }) => {
29+
const url = new URL(request.url);
30+
if (url.searchParams.get("filters") === "test-filter") {
31+
return HttpResponse.json({ data: [{ id: "1", name: "test-runtime-vuln" }] });
3132
}
32-
return res(ctx.json({ data: [] }));
33+
return HttpResponse.json({ data: [] });
3334
},
3435
),
3536
);

0 commit comments

Comments
 (0)