Answer the question
In order to leave comments, you need to log in
How to unit test Vue components in a Laravel application?
I did everything as the documentation says: Testing - Vue.js .
Here are the JEST settings in package.json:
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
".*\\.(vue)$": "<rootDir>/node_modules/vue-jest",
"^.+\\.js$": "<rootDir>/node_modules/babel-jest"
},
"collectCoverage": true,
"collectCoverageFrom": ["**/*.{js,vue}", "!**/node_modules/**"]
},
import { mount } from '@vue/test-utils'
import OrdersIndex from "../components/orders/OrdersIndex"
describe('Component OrdersIndex', () => {
test('является экземпляром Vue', () => {
const wrapper = mount(OrdersIndex)
expect(wrapper.isVueInstance()).toBeTruthy()
})
})
npm test
, JEST swears at all exports and imports in all components.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question