Jest preprocessor that resolves require() statements using webpack aliases. Version 3.3.4 (latest, no stable release cadence). Allows Jest to understand webpack alias resolution, but is deprecated in favor of babel-plugin-module-resolver. Handles JavaScript and non-JavaScript files through mocks, but AST limitations prevent dynamic require() resolution. Works with webpack multi-compiler profiles. Limited to webpack 1/2/3 style configurations.
npm install jest-webpack-aliasVerified import paths — ran on the pinned version, not inferred.
Shows the typical setup for a Jest preprocessor that applies babel-jest and webpack alias resolution.
Replace with babel-plugin-module-resolver and configure Jest moduleNameMapper for aliases.
Use resolve() function: require(resolve(moduleName, __filename))
Manual mock the file in __mocks__ directory, or use ignore-styles.
Ensure modulesDirectories is relative to package.json location.
Set up jest-webpack-alias preprocessor as described in the README.
Use require('jest-webpack-alias') instead of import.