Docs on configuring IDE to see <test> in .vue file incomplete
See original GitHub issueSoftware version
OS: Ubuntu Any other software related to your bug:
vscode: 1.35.1
What did you get as the error?
These instructions don’t work in vscode on my computer:
https://github.com/quasarframework/quasar-testing
You may notice that your IDE doesn't know how to parse the test block, so go into the <test/> block, press <alt> + <enter>, select 'inject language or reference' and select javascript. This will grant <test/> blocks autocomplete.
I may have misunderstood, but I put the <test> block in a .vue file like this:
<template lang="pug">
.dex
slot
</template>
<script>
/**
* A generic dex
*/
</script>
<style lang="stylus" scoped>
.dex {
width: 37vh;
height: 62vh;
background: white url('~assets/dex.svg') no-repeat center center;
background-size: cover;
box-shadow: 2px 5px 15px rgb(66, 21, 71);
border-radius: 3.5vh;
}
</style>
<test lang="jest">
// Import the mount() method from the test utils
// and the component you want to test
import { mount } from '@vue/test-utils'
import Counter from './counter'
describe('Counter', () => {
// Now mount the component and you have the wrapper
const wrapper = mount(Counter)
it('renders the correct markup', () => {
expect(wrapper.html()).toContain('<span class="count">0</span>')
})
// it's also easy to check for the existence of elements
it('has a button', () => {
expect(wrapper.contains('button')).toBe(true)
})
it('button should increment the count', () => {
expect(wrapper.vm.count).toBe(0)
const button = wrapper.find('button')
button.trigger('click')
expect(wrapper.vm.count).toBe(1)
})
})
</test>
What were you expecting?
To hit alt-enter and do the stuff the docs suggested, and the IDE to parse and lint the <test>
Pressing alt-enter didn’t seem to do anything.
What steps did you take, to get the error?
See above…
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Coverage report incorrect · Issue #480 · vuejs/vue-jest - GitHub
I've been trying to get jest to work properly with a Vue 2 + Vite project. ... Given an incomplete test suite, the...
Read more >Vue.js | IntelliJ IDEA Documentation - JetBrains
In the Settings/Preferences dialog ( Ctrl+Alt+S ), go to Editor | Code Style | Vue Template, and open the Tabs and Indents tab....
Read more >Vue.js style guide - GitLab Docs
We default to eslint-vue-plugin, with the plugin:vue/recommended . Check the rules ... Use a function in the bundle file to instantiate the Vue...
Read more >Vue JavaScript Tutorial in Visual Studio Code
Vue JavaScript tutorial showing IntelliSense, debugging, and code navigation support in the Visual Studio Code editor.
Read more >How to make test coverage show all vue files in Vue-cli 3 ...
That output simply tells you the tests in example.spec.js does not cover line 9 in App.vue . See updated screenshot (showing App.vue lines ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
That should mention Webstorm as the IDE where these commands work. Would love it if you could dig in and find a way to do this in VS Code.
Please check PR #135 for proposed VS Code instructions. If merged it could close this issue.