I am writing a Jest integration test to test my server. Here is my test:
import { app, port } from '../server' // the other lines are not so important
...
When running jest this raises an error:
__tests__/graphql.test.js
● Test suite failed to run
<project folder>/node_modules/papercut/lib/papercut.coffee:3
{FileStore, S3Store, TestStore } = require('./store')
^
SyntaxError: Unexpected token =
I am requiring server.js in my Jest test, this file requires upload.js and this file requires node module called papercut. The problem is, it's written in CoffeeScript, not pure JS.
At the beginning I had this error: Jest: cannot find module required inside module to be tested (relative path). I added coffee to my package.json's jest config like that:
"jest": {
"moduleFileExtensions": ["js", "json", "jsx", "node", "coffee"]
},
but now I have the error I've described above.
How can I handle this?