ricky2210's avatar

How to unit test a .vue component

I am in a process to unit test a vue component using Jasmine. The component is in a .vue file containing <script> and <template> tag. The following codes caused an error (it doesn’t like the script or template tags).

Vue.component(‘test’, require(‘./path/to/.vue’));

Any idea how to fix this error?

(function (exports, require, module, __filename, __dirname) { `<template>`
                                                         ^
SyntaxError: Unexpected token <

Thanks.

0 likes
0 replies

Please or to participate in this conversation.