lit: Unexpected token error in tests
I don’t know if this is lit-html related or not, but if I try to test something where lit-html is involved I get an unexpected token error:
/Users/foo/bar/baz/node_modules/lit-html/lit-html.js:14
import { defaultTemplateProcessor } from './lib/default-template-processor.js';
^
This happened with Mocha and Jest.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 2
- Comments: 21 (3 by maintainers)
Ah ha, I figured out a solution for the jest issue. In your jest config add the following
"transformIgnorePatterns": ["/node_modules/(?!lit-html).+\\.js"],This is important, re-name your babel config to babel.config.js (mine was .babelrc.js)
See here for the fix - https://github.com/facebook/jest/issues/6229#issuecomment-403539460
Hopefully that will help people!