A Jest transformer which enables importing assets into Jest's jsdom.
This is a custom Jest transformer turning file imports into filenames.
Note: SVG handling is mainly inspired from jest-transformer-svg.
Install with NPM or Yarn.
Run npm install jest-asset-transform -D
or yarn add jest-asset-transform -D
to install the library.
Please add the transformation module into the Jest's transform config:
{
"transform": {
"\\.[jt]sx?$": "babel-jest",
"^(?!.*\\.(js|jsx|mjs|cjs|ts|tsx|css|json)$)": "jest-asset-transform"
}
}
This project is licensed under the MIT license. See the LICENSE file for more info.