Rollup preprocessor for Jest.
npm install rollup-jest --save-dev
Add preset to Jest config:
{
"jest": {
"preset": "rollup-jest"
}
}
// alternatively, specifying the files to transform:
{
"jest": {
"transform": {
"\\.m?js$": "rollup-jest"
},
}
}
Writes your test with ES modules:
import path from 'path'
test('parses extname', () => {
expect(path.extname('foo.md')).toBe('.md')
})
Happy testing!