美文网首页
【jest 调试 - vscode debug】

【jest 调试 - vscode debug】

作者: wn777 | 来源:发表于2024-05-15 00:36 被阅读0次

    jest 测试typescript,如果想对测试文件本身断点调试。

    安装jest相关依赖

    # jest本体
    npm install --save-dev jest
    # jest的类型声明
    npm install --save-dev @types/jest
    # typescript中使用
    npm install --save-dev ts-jest
    

    launch.json 配置参考

    {
        "type": "node",
        "request": "launch",
        "name": "test",
        "runtimeExecutable": "npx",
        "runtimeArgs": ["jest", "--runInBand", "${workspaceFolder}/test/index.test.ts"],
        "protocol": "inspector"
    }
    

    相关文章

      网友评论

          本文标题:【jest 调试 - vscode debug】

          本文链接:https://www.haomeiwen.com/subject/aldvfjtx.html