Skip to main content

Code transformation

You should use Pre-configured transformation in most cases. However, if you have existing code transformation, you can use the following provided ones as follow:

  • processCss: Process CSS files
  • processFile: Process files assets like images

For examples:

// config/jest/cssTransform.js
'use strict';

const { processCss } = require('jest-preview');

module.exports = {
process(src, filename) {
return processCss(src, filename);
},
};
// config/jest/fileTransform.js
'use strict';

const { processFile } = require('jest-preview');

module.exports = {
process(src, filename) {
return processFile(src, filename);
},
};