question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Docs on configuring IDE to see <test> in .vue file incomplete

See original GitHub issue

Software 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:closed
  • Created 4 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
nothingismagickcommented, Jul 9, 2019

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.

0reactions
Blfrgcommented, Sep 14, 2020

Please check PR #135 for proposed VS Code instructions. If merged it could close this issue.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found