Home > other >  Unit test breaks after dependencies update for Node 16
Unit test breaks after dependencies update for Node 16

Time:02-04

I just made some changes to my project's package.json:

  • removed bundle-buddy-webpack-plugin
  • upgraded eslint from 4.11.0 to 6.0.0
  • upgraded prettier from 1.14.3 to 2.0.0
  • upgraded webpack from 4.28.1 to 4.36.0

Besides the above, all I did was formatting some text as lint wanted. That was all the changes.

But for some reason, on Windows, some unit tests that expect value break. Before these changes I was getting a numberDOTdecimals. Now, my expect fails because it gets numberCOMMAdecimals. Also I change Windows System Separator from comma to dot but it isn't helping.

jest unit tests failing because it receives comma instead of dot

Why this is a problem is that on my colleague mac it works just fine, as well on Jenkins where all suites of unit tests are running when creating a merge request.

Does anyone have any idea why this behavior occurs?

CodePudding user response:

Found the issue/difference. It was indeed the locale. It seems that it took that locale and used that format. Is interesting that before the upgrade above, I was calling toLocaleString with undefined and it used the EN format, but now it uses the system's one.

The solution was to change my system's Region/Format to whatever I was expecting to receive.

  •  Tags:  
  • Related