I'm using HJSON in a create-react-app project (see answer here), but Jest doesn't use the same webpack configuration, so fails to import HJSON properly - e.g.
import options from '../assets/options.hjson';
just sets options to the string '../assets/options.hjson'.
So how can you import an HJSON file using Jest?
You need to make a transformer module for Jest to convert the HJSON to JSON - see the docs here.
Make a file
jest-hjson-transformer.jsin your root directory withAnd in your
package.json,