country-region-data icon indicating copy to clipboard operation
country-region-data copied to clipboard

`allCountries` undefined in Jest

Open jasonburrows opened this issue 1 year ago • 2 comments

Here's a minimal reproduction:

import { allCountries } from 'country-region-data';

  test.only('countries should be defined', async () => {
    expect(allCountries).toBeDefined();
  });

Result:

    expect(received).toBeDefined()

    Received: undefined

Note that version 2.7.0 of country-region-data does not exhibit this behaviour (I can change nothing but the version and the test passes). Also note that v3.0.0 works correctly in the associated application, it is specifically the Jest test suite where it is undefined (and in the application itself when running in Jest).

Version information:

jest: 29.7.0 country-region-data: 3.0.0 node: 18.15.0

jasonburrows avatar Feb 09 '24 20:02 jasonburrows