vuejs / vue-test-utils

Component Test Utils for Vue 2
https://vue-test-utils.vuejs.org
MIT License
3.57k stars 668 forks source link

Usage #948

Closed AlexandreMPDias closed 6 years ago

AlexandreMPDias commented 6 years ago

Ok... so I (as far as I know) properly configured vue-test-utils/mocha-webpack/babel/etc...

Now, how do I build the test?? I mean, I know about the describe/it from mocha, and using the spec.files... I created some tests, to check if the test environment is working, and all tests passed... I know how to create a test... but I want to know the PROPER way...

I mean, for example... Inside my home-page, I want to check if when I click a given sequence of buttons, all the variables that should be updated are really updated...

I need to initalize the same way I would my main.js? Because here are the imports inside my 'main.js'

/* Main & Plugins */
import Vue from 'vue';
import VueRouter from 'vue-router';
import axios from 'axios';
import VueQuillEditor from 'vue-quill-editor';
import VueTheMask from 'vue-the-mask';
import VueSweetAlert from 'vue-sweetalert';
import VeeValidate, { Validator } from 'vee-validate';
import ptBR from 'vee-validate/dist/locale/pt_BR';
import Toasted from 'vue-toasted';
import VTooltip from 'v-tooltip';
import VueMq from 'vue-mq';
import { sync } from 'vuex-router-sync';
import MuseUI from 'muse-ui';
import Icon from 'vue-awesome/components/Icon';
//import FullCalendar from 'vue-full-calendar';
import VueSocketio from 'vue-socket.io';
import TimePicker from '~/src/components/plugins/timepicker/timePicker.vue';
import '~/src/assets/css/muse-ui.css';
import 'nprogress/nprogress.css';

/* Auth related */
import VueAuth from '@websanova/vue-auth';
import AuthBearer from '@websanova/vue-auth/drivers/auth/bearer';
import AuthHTTPDriver from '@websanova/vue-auth/drivers/http/axios.1.x';
import AuthRouterDriver from '@websanova/vue-auth/drivers/router/vue-router.2.x';

/* Global js modules */
import Katex from 'katex/katex.js';

import App from '~/src/components/App.vue';
import routes from '~/src/routes';
import store from '~/src/store';  

I need to import all this inside my .spec.js file?? Is that the correct approach?? Im trully lost in here lol, please someone shed me some light, or at least point me in the right direction...

vue-bot commented 6 years ago

Hello, your issue has been closed because it does not conform to our issue requirements. In order to ensure every issue provides the necessary information for us to investigate, we require the use of the Issue Helper when creating new issues. Thank you!