Prerequisites
Environment check
Browsers
Firefox
Reproduction repository
https://github.com/muelbr/mswjs-bug
Reproduction steps
I recently reported a bug here: #2709
Currently it seems that only Firefox has some restrictions that can lead to timing problems when run in a CI environment with perhaps not the same CPU power as locally.
Reproduction Repo
Contains: Vue / Vitest Browser Mode / msw / testing-library
__tests__/index -> Test fixture
mws.test.ts / mws2.test.ts -> Tests for simple REST calls
vitest.config -> browser mode config
Test
npm run test:bug -> Test with firefox and maxWorkers: 1 (simulation slow environment)
Some errors start to appear:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
npm run test:all -> Test with all major browsers locally
Everything is fine.
Remark
Just a single test file works, but as soon as there is another test file, the errors are occurring.
Seems that the timing sequence between whole tests is critical with firefox, which is perhaps more restrictive or slow to start the service worker.
Kind regards
Current behavior
2 Test files using Firefox in a slow environment are causing some JSON.parse bugs
Expected behavior
Tests are all successful.
Prerequisites
Environment check
mswversionBrowsers
Firefox
Reproduction repository
https://github.com/muelbr/mswjs-bug
Reproduction steps
I recently reported a bug here: #2709
Currently it seems that only Firefox has some restrictions that can lead to timing problems when run in a CI environment with perhaps not the same CPU power as locally.
Reproduction Repo
Contains: Vue / Vitest Browser Mode / msw / testing-library
__tests__/index-> Test fixturemws.test.ts / mws2.test.ts-> Tests for simple REST callsvitest.config-> browser mode configTest
npm run test:bug-> Test with firefox and maxWorkers: 1 (simulation slow environment)Some errors start to appear:
SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON datanpm run test:all-> Test with all major browsers locallyEverything is fine.
Remark
Just a single test file works, but as soon as there is another test file, the errors are occurring.
Seems that the timing sequence between whole tests is critical with firefox, which is perhaps more restrictive or slow to start the service worker.
Kind regards
Current behavior
2 Test files using Firefox in a slow environment are causing some JSON.parse bugs
Expected behavior
Tests are all successful.