| 1 |
/** |
| 2 |
* Jest configuration. |
| 3 |
* |
| 4 |
* Extends @wordpress/scripts' default so component tests can resolve the same |
| 5 |
* path aliases webpack.config.js defines — without this, importing anything |
| 6 |
* that reaches `@utils/…` fails to resolve under Jest while building fine. |
| 7 |
*/ |
| 8 |
const defaultConfig = require('@wordpress/scripts/config/jest-unit.config'); |
| 9 |
|
| 10 |
module.exports = { |
| 11 |
...defaultConfig, |
| 12 |
moduleNameMapper: { |
| 13 |
...(defaultConfig.moduleNameMapper || {}), |
| 14 |
'^@admin/(.*)$': '<rootDir>/src/admin/$1', |
| 15 |
'^@components/(.*)$': '<rootDir>/src/admin/components/$1', |
| 16 |
'^@utils/(.*)$': '<rootDir>/src/admin/utils/$1', |
| 17 |
'^@/(.*)$': '<rootDir>/src/$1', |
| 18 |
}, |
| 19 |
}; |
| 20 |
|