Skip to content

Improving on "Using with jest" and "Getting started" docs. (Basic jest, vue-jest and vue-test-utils setup is not enough to get started, requires more setup and leads to unexpected errors) #1666

Closed
@ColtHands

Description

@ColtHands
Documentation Feedback

Improving on Using with Jest and Getting started

Key issues with Using with Jest

  • This guide is not at all complete and will require more steps to actually get started
  • Those additional steps require adding additional dependencies some of which are peer dependencies which may produce unexpected errors.

Key issues with Getting started

  • First line of the example is import { mount } from '@vue/test-utils' statement which results in SyntaxError: Cannot use import statement outside a module error.
  • This requires an additional setup with babel jest, which is not mentioned in Using with Jest part of the docs. "transform": { "^.+\\.js$": "babel-jest" }
  • Which in addition requires sometimes spits out an error that it requires babel-core not @babel/core, not only that it requires specific babel-core@^7.0.0-bridge.0 Reference issue comment. Which some times requires to move .babelrc to babel.config.js Reference issue comment
  • This could be solved by simple additional installation requirements and simple babel config inside package.json

Proposition

Add few additional installation requirements inside using with jest or getting started docs, which are

  • changing Note about babel-bridge to clear instruction on how to install and add babel support
  • adding @babel/core @babel/preset-env babel-jest babel-core@^7.0.0-bridge.0 packages
  • adding "babel": { "presets": ["@babel/preset-env"] } inside package.json
  • adding "jest": { "transform": { ".*\\.(js)$": "babel-jest" } inside package.json or other Jest config

I would love to participate and work on that issue adding additional info inside docs. With additional discussion from the developers and clear requirements in what doc file should be modified and what should be added.

My understanding is that Using with Jest should be modified, with additional babel setup info. I'll work on adding the docs and will create a pull request for a review.

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