test: setup automated tests with jest

This commit is contained in:
David Laganiere 2023-01-03 19:07:54 -05:00
parent 8785b94392
commit 23be268630
No known key found for this signature in database
GPG key ID: 18C4B80581C28747
4 changed files with 745 additions and 15 deletions

32
frontend/jest.config.js Normal file
View file

@ -0,0 +1,32 @@
// Add any custom config to be passed to Jest
const customJestConfig = {
setupFilesAfterEnv: ["<rootDir>/jest.setup.js"],
moduleDirectories: ["node_modules", "<rootDir>/"],
transform: {
// Use babel-jest to transpile tests with the below presets
// https://jestjs.io/docs/configuration#transform-objectstring-pathtotransformer--pathtotransformer-object
"^.+\\.(js|jsx|ts|tsx)$": [
"babel-jest",
{
presets: [
"@babel/preset-env",
[
"@babel/preset-react",
{
runtime: "automatic",
},
],
],
},
],
},
testEnvironment: "jest-environment-jsdom",
moduleNameMapper: {
"^uuid$": require.resolve("uuid"),
"^@fontsource/roboto$": "identity-obj-proxy",
"\\.(png)$": "identity-obj-proxy",
},
testPathIgnorePatterns: ["<rootDir>/cypress/"],
};
module.exports = customJestConfig;