Closed hays0503 closed 2 months ago
@kettanaito
It looks like 2.4.4 really has something weird, it's like the third issue breaking people tests. Maybe you'd want to deprecate it on npm until a new version can be released?
David
I've gotten this error too after running an npm audit fix
, first using msw 2.1.3 and also trying 2.4.5
We have a similar issue:
[2024-09-11T12:59:24.766Z] TypeError: Cannot assign to read only property 'Headers' of object '[object Object]'
[2024-09-11T12:59:24.766Z]
[2024-09-11T12:59:24.766Z] 4 |
[2024-09-11T12:59:24.766Z] 5 | export function prepareMockServer(mockServer: SetupServer): void {
[2024-09-11T12:59:24.766Z] > 6 | mockServer.listen();
[2024-09-11T12:59:24.766Z] | ^
Temporarily solved the problem by rolling back to an older version of the library ("msw": "^2.4.3")
I have the exact same issue after upgrading to the lastest version of msw. Fixed by rolling back to v2.4.3, as other commenters have said.
confirmed, since 2.4.4
our tests fail in the same manner.
TypeError: Cannot assign to read only property 'Request' of object '[object Window]'
on a beforeAll(() => server.listen());
I narrowed it down to this commit :
Overriding the dependency fixes the bug : "@mswjs/interceptors": "0.32.1"
This has a similar root cause and the fix as https://github.com/mswjs/msw/issues/2281#issuecomment-2351462039.
@davesidious,
Maybe you'd want to deprecate it on npm until a new version can be released?
There is no concept of deprecating or unpublishing a package on NPM. Software has bugs, and we've done a ton of changes and improvements in that Interceptors update. Honestly, it's a surprisingly little number of bugs, and most of them are related.
You should pin MSW to a specific version that worked for you until the issues are resolved. That's how to handle it in open source.
There is no concept of deprecating or unpublishing a package on NPM.
That’s actually incorrect, see https://docs.npmjs.com/deprecating-and-undeprecating-packages-or-package-versions
That said, I agree that it’s not really necessary in this particular case, especially since there seems to be a fix now.
This has been released in v2.4.7!
Make sure to always update to the latest version (npm i msw@latest
) to get the newest features and bug fixes.
Predictable release automation by @ossjs/release.
Prerequisites
Environment check
msw
versionNode.js version
v20.16.0
Reproduction repository
https://github.com/hays0503/sck1
Reproduction steps
Run test "test:coverage": "jest --coverage" And get error
FAIL src/entities/ComponentSelectCity/ui/test/ComponentSelectCity.test.tsx × Фильтрация городов при поиске
● Фильтрация городов при поиске
Current behavior
I noticed that the error started appearing with version 2.4.4. I rolled back to older versions and the problem was solved.
Expected behavior
Fixing the problem