Closed pieterjandebruyne closed 1 year ago
Jest is a pile of junk. I'd suggest using Vitest instead
Just adding some more informations about the workaround. If your project are using Next.js then the transformIgnorePatterns should be added like this:
const esModules = ['chartjs-adapter-luxon'].join('|');
const customJestConfig = {...};
const jestConfig = async () => {
const nextJestConfig = await createJestConfig(customJestConfig)();
nextJestConfig.transformIgnorePatterns[0] = `/node_modules/(?!${esModules})`;
return nextJestConfig;
};
@pieterjandebruyne, thanks for the workaround!
Versions: "chart.js": "^4.2.1", "chartjs-adapter-luxon": "^1.3.1",
Issue:
import 'chartjs-adapter-luxon'
crashes on jest tests.Error:
I already found a workaround for this myself but I think it could be helpful for other people here trying to do the same in a typescript esm project:
in jest.config.ts add:
in tsconfig.json make sure you have: