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 omitsvue-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'spackage.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
1 Answer
Reset to default 8Jest 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条)