After following a tutorial on building a Vue.js component (), I proceeded to follow another tutorial on unit testing the same component (). Unfortunately, the unit test failed at the import statement within the component code, resulting in the following error message:
● Test suite failed to run
C:\Users\SHINIGAMI-ALFSABAH\Documents\Workspace\Dev\Vue\star-rating\node_modules\vue-awesome\icons\star.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import Icon from '../components/Icon.vue'
^^^^^^
SyntaxError: Cannot use import statement outside a module
12 |
13 | <script>
> 14 | import 'vue-awesome/icons/star'
| ^
15 | import Icon from 'vue-awesome/components/Icon'
16 |
17 | export default {
at ScriptTransformer._transformAndBuildScript (node_modules/@jest/transform/build/ScriptTransformer.js:537:17)
at ScriptTransformer.transform (node_modules/@jest/transform/build/ScriptTransformer.js:579:25)
at src/components/Rating.vue:14:1
at Object.<anonymous> (src/components/Rating.vue:67:3)
Any assistance provided would be greatly appreciated.