首页 文章

如何使用VSCode工具调试jasmine karma测试

提问于
浏览
0

我正在使用Visual Studio Code编写基于茉莉花和业力的单元测试用例 . 我想知道是否有一种方法可以在vs代码工具本身中调试测试 .

1 回答

  • 0
    • 打开调试选项卡

    • 添加Chrome配置,它会为您填写大部分字段 . 对于端口,将其更改为 9876 (或 karma.conf.js 中指定的任何内容) . 见下文 .

    • 在要调试的代码中设置断点

    • 运行调试任务,该任务将打开指向端口的chrome窗口

    • 运行测试命令( ng test )并根据需要刷新打开的Chrome窗口

    样本配置,它们是在名为 launch.json 的字段中创建的

    {
        // Use IntelliSense to learn about possible attributes.
        // Hover to view descriptions of existing attributes.
        // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
        "version": "0.2.0",
        "configurations": [
            {
                "type": "chrome",
                "request": "launch",
                "name": "Launch Chrome against localhost",
                "url": "http://localhost:9876",
                "webRoot": "${workspaceFolder}"
            }
        ]
    }
    

相关问题