Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

coverage report is wrong!!! #106

Closed
noprogram-programmer opened this issue Sep 28, 2018 · 5 comments
Closed

coverage report is wrong!!! #106

noprogram-programmer opened this issue Sep 28, 2018 · 5 comments
Labels

Comments

@noprogram-programmer
Copy link

counter.vue

<template>
    <div>
      <span class="count">{{ count }}</span>
      <button @click="increment">Increment</button>
    </div>
</template>
<style>
</style>
<script>
export default {
  name: "counter",
  data() {
    return {
      count: 0
    };
  },

  methods: {
    increment() {
      this.count++;
    }
  }
};
</script>

counter.test.js

import { mount } from "@vue/test-utils";
import Counter from "./counter.vue";

describe("Counter", () => {

  const wrapper = mount(Counter);

  const vm = wrapper.vm;

  it("rendenr correct to 0", () => {
    expect(wrapper.html()).toContain('<span class="count">0</span>');
  });

  it("is a button", () => {
    expect(wrapper.contains("button")).toBe(true);
  });

  it("click a button to increment count", () => {
    expect(wrapper.vm.count).toBe(0);
    const button = wrapper.find("button");
    button.trigger("click");
    expect(wrapper.vm.count).toBe(1);
  });
});

Problem

image
Mark the red box, i 'm not find the uncoverage line of 33,34 and branch 50% .Please resolve my doubts.

@kevinmarrec
Copy link

kevinmarrec commented Oct 18, 2018

@eddyerburgh Any update on this ?

On my side I have :
screenshot_1

I couldn't be able to have a proper ts-jest + vue-jest with 100% Coverage even with empty component :/

EDIT : It's working (100% coverage) if I use Vue.extend, it seems that's something goes wrong using @Component TypeScript Class Decorator.

@araujrafa
Copy link

I have the same problem, has anyone found a solution?

@kevinmarrec
Copy link

kevinmarrec commented Nov 29, 2018

@araujrafa I got it working but I don't honestly remember how (I mean I don't remember how looked like my "not-working" configuration 😅). Can you please tell me what's your app context: is it using Nuxt or/and Vuetify ? Then I'll be able to help you 😉

@eddyerburgh
Copy link
Member

Yes, I'm working on improving source map support. My aim is to get a beta version out within the next month. If anyone would like to help, this is the last major work to be done—#114

@eddyerburgh
Copy link
Member

I've release 4.0.0-beta.0. Please use that version to see if it fixes the coverage issue. If not, please create a new issue with a runnable reproduction.

This issue is being tracked in #56

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants