What
Configure Jest so it resolves absolute imports the same way your app does (e.g., @/components/Button).
Why
Jest does not automatically apply your TypeScript path aliases. Map the @/ prefix to the project root with moduleNameMapper so tests resolve @/components/Button like the application does.
How
// jest.config.js
module.exports = {
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/$1",
},
};