Skip to content

Cannot find module '../BlogPost.vue' or its corresponding type declarations. #8

Open
@Mnigos

Description

@Mnigos

I have some problem with importing component I have test file in the same folder as component.

BlogPost.spec.ts

import 'jest';
import { shallowMount } from '@vue/test-utils';
import BlogPost from './BlogPost.vue';

describe('BlogPost Component', () => {
  it('Displaying posts from data', () => {
    const title = 'New Title';
    const wrapper = shallowMount(BlogPost, {
      propsData: { title },
    });
    expect(wrapper.text()).toMatch(title);
  });
});

BlogPost.vue

<template>
  <div class="d-flex flex-column align-center">
    <div class="rounded-xl blog-post">
      <v-row>
        <v-col>
          <div class="d-flex justify-center">
            <h1>{{ title }}</h1>
          </div>
          <div class="d-flex justify-center">
            <v-img :src="image" />
          </div>
          <div class="d-flex justify-center">
            {{ description }}
          </div>
        </v-col>
      </v-row>
    </div>
  </div>
</template>

<script lang="ts">
import Vue from 'vue';

export default Vue.extend({
  name: 'BlogPost',
  props: {
    title: String,
    image: String,
    description: String,
    date: Date,
  },
});
</script>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions