Creating vite vue ts template: Setup Jest

This page summarizes the projects mentioned and recommended in the original post on dev.to

Our great sponsors
  • SurveyJS - Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • ts-jest

    A Jest transformer with source map support that lets you use Jest to test projects written in TypeScript.

    We are using typescript in our project. To properly setup jest we would need to install ts-jest package as well.

  • jest

    Delightful JavaScript Testing.

    $ npm run test > [email protected] test > jest FAIL tests/unit/HelloWorld.spec.ts HelloWorld.vue ✕ renders props.msg when passed (2 ms) ● HelloWorld.vue › renders props.msg when passed The error below may be caused by using the wrong test environment, see https://jestjs.io/docs/configuration#testenvironment-string. Consider using the "jsdom" test environment. ReferenceError: document is not defined 5 | it('renders props.msg when passed', () => { 6 | const msg = 'new message' > 7 | const wrapper = shallowMount(HelloWorld, { | ^ 8 | props: { msg }, 9 | }) 10 | expect(wrapper.text()).toMatch(msg) at mount (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7640:14) at Object.shallowMount (node_modules/@vue/test-utils/dist/vue-test-utils.cjs.js:7852:12) at Object. (tests/unit/HelloWorld.spec.ts:7:21) Test Suites: 1 failed, 1 total Tests: 1 failed, 1 total Snapshots: 0 total Time: 4.061 s Ran all test suites.

  • SurveyJS

    Open-Source JSON Form Builder to Create Dynamic Forms Right in Your App. With SurveyJS form UI libraries, you can build and style forms in a fully-integrated drag & drop form builder, render them in your JS app, and store form submission data in any backend, inc. PHP, ASP.NET Core, and Node.js.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts