当前位置:网站首页>在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决
在 VSCode 中调试 Jest 的测试用例,VSCode调试Jest测试用例报错basedir=$(dirname “$(echo “$0“ | sed -e ‘s,\\,/,g‘)“)解决
2022-04-23 12:03:00 【scluis】
步骤
首先,如果没有launch.json文件,需要打开VsCode的运行和调试选项卡(快捷键Ctrl+Shift+D)创建launch.json文件
然后,在launch.json中配置如下:
{
"version": "0.2.0",
"configurations": [{
"name": "Debug Jest Tests",
"type": "node",
"request": "launch",
"runtimeArgs": [
"--inspect-brk",
"${workspaceRoot}/node_modules/jest/bin/jest.js",
"--runInBand"
],
"console": "integratedTerminal",
"internalConsoleOptions": "neverOpen",
"port": "9229"
}]
}
配置完成后,就添加了一项针对Jest的调试,这里显示的Debug Jest Tests就是我们配置的name字段。
在VsCode中打了断点后,点击绿色开始按钮或者使用调试快捷键F5即可开始调试。
遇到的坑
一开始配置完launch.json文件启动调试时,总是报错
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
将launch.json文件中的"${workspaceRoot}/node_modules/.bin/jest"
替换为 "${workspaceRoot}/node_modules/jest/bin/jest.js"
即可解决问题。
版权声明
本文为[scluis]所创,转载请带上原文链接,感谢
https://blog.csdn.net/weixin_42619772/article/details/124333785
边栏推荐
- Tensorflow common functions
- Sofa weekly | excellent Committee of the year, contributor of this week, QA of this week
- 第五章 使用In-Memory表达式优化查询(IM 5.1)
- On lambda powertools typescript
- 第二十六课 类的静态成员函数
- The fourth chapter is the enable and disable columns of IM enabled fill objects (Part III of im-4.3)
- PCB的注意事项
- golang之筆試題&面試題01
- ES6 learning notes II
- Nacos Basics (5): getting started with Nacos configuration
猜你喜欢
软件测试基础DAY2-用例执行
After a circle, I sorted out this set of interview questions..
Database design of forum system
Force buckle - 1137 Nth teponacci number
【Redis 系列】redis 学习十三,Redis 常问简单面试题
Win10 splash screen after startup
抓包整理————tcp 协议[八]
智能多线弹性云增加独立的IP地址,如何实现多线功能?
同态加密技术学习
Analyzing the role of social robots in basic science
随机推荐
编程辅助工具推荐:图片工具snipaste
全网最细的短网址系统设计与实战
数组---
魔域来了H5游戏详细图文架设教程
Yunna | fixed assets inventory supports multiple inventory methods (asset inventory)
Yunna | how to manage the company's fixed assets and how to manage fixed assets
ES6学习笔记二
软银愿景基金进军Web3安全行业 领投CertiK 6000万美元新一轮投资
程序员如何用130行代码敲定核酸统计
Chapter 4: enable and disable im column storage for materialized view (IM 4.6)
《通用数据保护条例》(GDPR)系列解读三:欧洲子公司如何向国内母公司回传数据?
Redis learning 5 - high concurrency distributed lock practice
Nativeformysql connects to MySQL 8 prompt: 1251 - client does not support authentication protocol
第五章 使用In-Memory表达式优化查询(IM 5.1)
IDEA 数据库插件Database Navigator 插件
ImportError: libX11. so. 6: cannot open shared object file: No such file or directory
同态加密技术学习
怎么进行固定资产盘点,资产盘点报告如何一键生成
In idea Solution to the problem of garbled code in Chinese display of properties file
为什么要有包装类,顺便说一说基本数据类型、包装类、String类该如何转换?