-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Upgrade msw to 2.7.0 (and Node.js to 22.13.1) in /ui
The main purpose was to upgrade msw from 0.36.8 to 2.7.0, to get rid of the security alerts of the old version. The upgrade turned out to be quite difficult, and in the end I only got the tests to pass with this combination of other dependencies: - test running environment: @happy-dom/jest-environment - jsdom (the default) or jest-fixed-jsdom (suggested in many places around the internet) neither worked due to various different errors. - Node.js version: 22 - I don't have an explanation, but with Node 20 the tests often fail to navigate to other pages, without visible errors, though sometimes the tests do pass. I saw the same failing behavior in other running environments than @happy-dom/jest-environment too, but in those there were also some visible errors. With Node 22, the tests seem to run notably faster, which might be related. - Version 22 has been in long-term support for quite a while now, so it's good to move to it anyway. Signed-off-by: Harri Lehtola <[email protected]>
- Loading branch information
Showing
6 changed files
with
234 additions
and
383 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
v20.18.0 | ||
v22.13.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,25 @@ | ||
import { rest } from "msw"; | ||
import {readFileSync} from 'fs'; | ||
import { http, HttpResponse } from "msw"; | ||
import { readFileSync } from 'fs'; | ||
import path from "path"; | ||
|
||
const registry = readFileSync(path.resolve(__dirname, "../../public/registry.db")); | ||
|
||
const projectsListWithDefaultProject = rest.get( | ||
"/projects-list.json", | ||
(req, res, ctx) => { | ||
return res( | ||
ctx.status(200), | ||
ctx.json({ | ||
default: "credit_score_project", | ||
projects: [ | ||
{ | ||
name: "Credit Score Project", | ||
description: | ||
"Project for credit scoring team and associated models.", | ||
id: "credit_score_project", | ||
registryPath: "/registry.pb", | ||
}, | ||
], | ||
}) | ||
); | ||
} | ||
const projectsListWithDefaultProject = http.get("/projects-list.json", () => | ||
HttpResponse.json({ | ||
default: "credit_score_project", | ||
projects: [ | ||
{ | ||
name: "Credit Score Project", | ||
description: "Project for credit scoring team and associated models.", | ||
id: "credit_score_project", | ||
registryPath: "/registry.pb", | ||
}, | ||
], | ||
}) | ||
); | ||
|
||
const creditHistoryRegistry = rest.get("/registry.pb", (req, res, ctx) => { | ||
return res( | ||
ctx.status(200), | ||
ctx.set('Content-Type', 'application/octet-stream'), | ||
ctx.body(registry)); | ||
}); | ||
const creditHistoryRegistry = http.get("/registry.pb", () => | ||
HttpResponse.arrayBuffer(registry.buffer) | ||
); | ||
|
||
export { projectsListWithDefaultProject, creditHistoryRegistry }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.