I’m using the webpack template generated by Vue’s CLI and have been trying to add some unit tests. And example has already been provided and it works perfectly: Then I try to add another test which I copied straight from Vue’s documentation (Documentation link) but something weird happened: I got the following error: So it seems like Hello.created gives me
Tag: karma-runner
Global variables in Karma test runner
I have a global variable defined in my main template, which I use to store information bits from the back end, such as the environment context path. I can’t move that variable inside a service. How can I expose that variable to Karma when I run the unit tests? Answer You either declare that global variable within your test file: