diff --git a/config/fileTransformer.js b/config/fileTransformer.js new file mode 100644 index 0000000..39172bc --- /dev/null +++ b/config/fileTransformer.js @@ -0,0 +1,9 @@ +// source: https://jestjs.io/docs/code-transformation#examples + +const path = require('path'); + +module.exports = { + process(src, filename, config, options) { + return 'module.exports = ' + JSON.stringify(path.basename(filename)) + ';'; + }, +}; diff --git a/jest.config.js b/jest.config.js index a179e4d..a0bfe47 100644 --- a/jest.config.js +++ b/jest.config.js @@ -6,6 +6,8 @@ module.exports = { ], transform: { '^.+\\.(ts|tsx)$': 'ts-jest', + '\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': + './config/fileTransformer.js', }, globals: { 'ts-jest': {