addons-frontend/tests/fileTransformer.js

10 строки
333 B
JavaScript

// This transformer is used by jest so that require('blah/baz/foo.jpeg') returns 'foo.jpeg'.
// See jest.config.js for the list of file extensions that use this transform.
const path = require('path');
module.exports = {
process(src, filename) {
return `module.exports = ${JSON.stringify(path.basename(filename))};`;
},
};