Jest: Unexpected token export
NillDk opened this issue · comments
I have an Angular application with Jest testing.
If I install SubSink as an npm package (https://www.npmjs.com/package/subsink), my tests fail with the following error:
Jest encountered an unexpected token
SyntaxError: Unexpected token export
As far as I understand, this happens because the package has been transpiled to ES2015 and not ES5. I haven't been able to find a Jests configuration solution.
have you tried to Adjust your transformIgnorePatterns whitelist
Something like this wherever your jest config is (jest.config.js
or package.json
). Below is a package.json
example.
{
"jest": {
"transformIgnorePatterns": [
"node_modules/(?!subsink)"
]
}
}
Yep, I tried that but couldn't make it work.
For now, I have just copied the code into my own repo.
@NillDk -- you can install my fork from npm, or create your own and update the module
entry in tsconfig.json, to solve the issue until my PR is merged.
npm install --save kgdiem/subsink#master
@kgdiem - Thanks, I'll take a look at it.
Looking forward to the merge :)
@kgdiem - Thanks, I'll take a look at it.
Looking forward to the merge :)
Were you able to make it work with this fork?
@ajaynarang, I actually haven't tried it yet.
I had already copied the code into my own repository and got caught away with other tasks.
Any update on merging this? I am also have the above issue
@NillDk @kgdiem - Thanks, I just tried it, it worked for me, will check if this is PR is merged. All other solution like adding path to transformIgnorePatterns both in global and local/lib jest.config file didn't work.
Yep, my fork is installed and working in my app. Unfortunately there has been no activity in this repo for ~7 months now.
@wardbell are you looking for new maintainers?
@wardbell Please merge this. please
Looking