Vue Test Utils is Vue’s official library for testing Vue components from Node.js. For example, suppose you have a simple counter component:

const Vue = require('vue');

module.exports = Vue.component('App', {
  data: () => ({ count: 0 }),
  methods: {
    increment: function increment() {
      ++this.count;
    }
  },
  template: `
    <div>
      <span>{{count}}</span>
      <button @click="increment">Increment</button>
    </div>
  `
});

#node #vue #testing #javascript #web-development

Getting Started Testing Vue Components in Node.js with Vue Test Utils
2.55 GEEK