How to solve 'SyntaxError: Unexpected identifier' while testing vuetify components using jest How to solve 'SyntaxError: Unexpected identifier' while testing vuetify components using jest vue.js vue.js

How to solve 'SyntaxError: Unexpected identifier' while testing vuetify components using jest


@barakbd is actually right, don't know why his answer is downvoted.

You can first try manually clearing cache with jest --clearCache and if that doesn't work, restart should help which seems to clear another cache that also affected jest.

Restart solved the issue for me.


Had the same error message with vue-test-utils via jest. Cause was of course different, mine was first import "highlight.js/styles/atom-one-dark.css". After commenting out, something other errored same style. Turned out that a cyclic dependency was the cause. In my case, main.ts exported a function used by store.ts. And main.ts used exported from store.ts. Moved exported function to utils.ts, error disappeared.


Restart computer. I kid you not, I had the same error, tried figuring it out for 2 days. A full system restart solved the issue.