javascript - Difference between @vuecli-plugin-unit-jest and vue-jest? - Stack Overflow

What is the difference between these two packages:@vuecli-plugin-unit-jestvue-jestIf I have one is th

What is the difference between these two packages:

  • @vue/cli-plugin-unit-jest

  • vue-jest

If I have one is the other unnecessary? If so, when should one use one or the other?

What is the difference between these two packages:

  • @vue/cli-plugin-unit-jest

  • vue-jest

If I have one is the other unnecessary? If so, when should one use one or the other?

Share Improve this question edited Dec 16, 2019 at 20:33 jonrsharpe 122k30 gold badges268 silver badges475 bronze badges asked Dec 16, 2019 at 20:29 wsyq1nwsyq1n 1173 silver badges11 bronze badges 4
  • 2 The CLI plugin dependes on vue-jest itself. – jonrsharpe Commented Dec 16, 2019 at 20:33
  • Interesting, just saw a package.json that omits vue-jest but has the CLI plugin. Of course, it is not actually running any unit tests. – wsyq1n Commented Dec 16, 2019 at 20:38
  • 1 You don't need to include it in package.json yourself, it's in the plugin's package.json: npmjs./package/@vue/cli-plugin-unit-jest (see dependencies tab or look at the file on GitHub). – jonrsharpe Commented Dec 16, 2019 at 20:39
  • Ah okay got it. thanks. – wsyq1n Commented Dec 16, 2019 at 20:39
Add a ment  | 

1 Answer 1

Reset to default 8

Jest is JS testing framework and understands only JS.

So vue-jest is used to transform the SFC(.vue) file to a format understandable by jest. Its job ends there.

On the other hand, @vue/cli-plugin-unit-jest is the webpack type plugin that does more things in addition to just transforming the code and has deeper level integration with vue cli. It internally uses vue-jest to achieve some level of functionality.

Capabilities of @vue/cli-plugin-unit-jest includes

  • Transforms your vue files to JS to be feed to jest.
  • creating a boilerplate jest setup with example tests when installed.
  • Adding all the eslint and package dependencies.
  • providing wrappers to run the jest tests which provide specific hints to babel to avoid build issues.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744174066a4561669.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信