Create a project called “vue-unit-test-demo” using the commands provided by the vue CLI.

Vue create vue-unit-test-demo, press EnterCopy the code

Default option: Default ([Vue 2] Babel, eslint)

Arrow keys, select Manually select features, and press EnterCopy the code

Choose Vue version, Babel, Linter/Formatter/ are selected by default, as shown below

Under the arrow keys, select the configuration you need: here, Unit Testing is selected and press EnterCopy the code

Configure all items selected in the previous step (according to your own habits Or project requirements)

Version configuration: Select 2.x and press EnterCopy the code

Error checking configuration: select Eslint + Prettier, press EnterCopy the code

Eslint focuses on code validation

Prettier focuses on formatting

With both, work is not tired ^_^

When to check: Lint in save is selected, enterCopy the code

Unit tests: Jest is selected, press EnterCopy the code

Save configuration files: select In addtional Config Files (In a separate file)Copy the code

Do YOU want to save the configuration? (you can use it next time) : n is selected here (not saved)Copy the code

At this point, the manual configuration is selected and you wait for the creation to complete.

The project has been created, with several more items than the Default “Default ([Vue 2] Babel, eslint)”.

In the previous manual configuration, the Vuex and Router are not selected. If necessary, you can manually configure them in the vue-unit-test-demo directory.

Command:

// Configure Vuex NPM install Vuex --save // Configure vue router NPM install vue-routerCopy the code