gpt4 book ai didi

在 VS Code 上调试 Jest

转载 作者:行者123 更新时间:2023-12-03 14:57:58 24 4
gpt4 key购买 nike

我正在尝试使用 VS Code 调试 Jest 单元测试。我有以下配置文件设置

"configurations": [
{
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules//jest/bin/jest.js",
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen"
}
]

但是,当我运行 (F5) VS Code 时,出现以下错误

错误:测试运行完成后必须存在 AggregatedResult

知道为什么吗?

最佳答案

我无法回答确切的问题,但是这个用于调试 Jest 的基本启动配置对我有用,包含 Jest 跳过文件也很简单

    {
"type": "node",
"request": "launch",
"name": "Jest",
"program": "${workspaceRoot}/node_modules/jest/bin/jest.js",
"args": [
"-i"
],
"skipFiles": [
"<node_internals>/**/*.js", "node_modules",
]
},

关于在 VS Code 上调试 Jest,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47563964/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com