Skip to content

vue-test-utils + jest 单元测试-vs code jest 插件 #51

Description

@huangshuwei

前言

编写单元测试用例时,难免频繁的执行单元测试命令。正所谓“工欲善其事,必先利其器”,这里推荐一块 vs code jest 单元测试插件

安装

1、通过浏览器点击安装 安装地址
2、vs code 插件市场搜索。插件名称: “Jest Runner” ,插件id:"firsttris.vscode-jest-runner"

使用

使用非常简单,随便打开一个你在编写的用例文件。

方法1:
每个用例上面都会有 “Run | Debug”提示。“Run”代表只运行用例,但不测试;“Debug”代表运行并且测试用例。
效果如下:
image

方法2:
在用例代码区域右键菜单,能够看到 “Debug Jest”、“Run Jest”、“Run Jest File” 三个选项,按照你自己的需求选择即可测试。
效果如下:
image

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions