I want to use the Jest testing framework to test vanilla Javascript (not React). I'm getting an error SyntaxError: Unexpected token import
.
My file is called functionName.js
and my test file is called functionName.test.js
. Both are in the same folder. I used export const functionName
and import functionName from './functionName.js'
to export/import the function I'm testing. It works fine when I use module.exports = functionName
and const functionName = require('./functionName.js')
but that's ES5 notation and I want to write it in ES6.
I'm new to using Jest, so any help would be much appreciated, thanks.
Aucun commentaire:
Enregistrer un commentaire