alphagov/paas-admin

Tests running stangely on my machine

0atman opened this issue · 2 comments

Creating this issue to track my investigation.
I think this is likely a problem with my machine, but we'll see.

The problem is this test fails with a en-US-like string:

    expect(received).toContain(expected) // indexOf

    Expected substring: "Monday, February 24, 2020"
    Received string:    "Monday, 24 February 2020"

      280 |     const input = '2020-02-24T16:32:03.000Z';
      281 |     const output = formatDate(new Date(input),{ weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
    > 282 |     expect(output).toContain('Monday, February 24, 2020');

But my machine seems to be recognised by node as en-GB:

λ node
> new Intl.DateTimeFormat().resolvedOptions().locale
'en-GB'

Ways to fix this:

  1. Remove the test
  2. fix @0atman's odd locale
 FAIL  src/components/performance/controllers.test.tsx
  ● formatDate › should output date string based on provided format options from given timestamp

    expect(received).toContain(expected) // indexOf

    Expected substring: "Monday, February 24, 2020"
    Received string:    "Monday, 24 February 2020"

PROGRESS, I updated my node to latest and only the locale error remains 😆

Problem solved, switching to the .nvmrc version of node fixed everything! Locales work differently in BOTH 10 and 14, we're on node 12.

Screenshot from 2021-05-10 16-38-27