Hey, vue-test-utils got released and since then I’ve decided to integrate it into my project. I chose the path of Testing SFCs with Jest and followed the guide to integrate it.
Testing SFC’s now works! So long as the component does not import anything from
Initially, I ran into the issue of:
Cannot find module 'quasar' from 'Hello-Two.vue'
As per research and asking around, was advised to add an alias to my Jest configuration, which looks like this:
Unfortunately, the issue has now mutated to:
SyntaxError: Unexpected token export in the
This has been reported multiple times by other users here, here and some mention of it; in the Quasar Gitter chat but unfortunately, there is no definitive answer on how to resolve it and hoping to compile it all here.
Although this post potentially hints at a fix but am unclear how to proceed. As importing from
quasar-framework leads to the same outcome.
I’ve created a git repo to recreate the problem using the Quasar PWA template.
Clone it if you wish and run the
quasar test command to begin the testing process.
Hello.spec.js passes as it do not import any
Hello-Two.spec.js fails, due to
SyntaxError: Unexpected token export as mentioned above. This component also import’s a
Researching this issue in general, it seems to lay with the way babel transpiles such that Jest can understand Quasar. As a result, it is now out of my depth and was hoping someone could provide some insight into how to resolve this?