问题描述
我正在尝试启用 JEST 单元测试的逐步调试。我有两种方法 - 在 Windows 主机上和在 ubuntu docker 容器中。 Ubuntu 容器
node ./node_modules/@vue/cli-service/bin/vue-cli-service.js test:unit -- ./path/to/file.spec.ts
成功运行测试。
在 Windows 主机上:
node ./node_modules/@vue/cli-service/bin/vue-cli-service.js test:unit -- .\path\to\file.spec.ts
No tests found,exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\Users\HrabeT\Work\Plates\frontend
266 files checked.
testMatch: **/tests/unit/**/*.spec.[jt]s?(x),**/__tests__/*.[jt]s?(x) - 4 matches
testPathIgnorePatterns: \\node_modules\\ - 266 matches
testRegex: - 0 matches
Pattern: .\path\to\file.spec.ts - 0 matches
容器和主机上的节点版本相同。我的目标是使用 node inspect
逐步调试测试,但我无法让主机 chrome 连接到容器会话,所以我试图在主机上运行它。然而,它无法理解文件?
我的测试在 ./tests/unit/path/to/file
中,这是开玩笑的配置
2 module.exports = {
3 preset: "@vue/cli-plugin-unit-jest/presets/typescript-and-babel",4 moduleNameMapper: {
5 "^@/(.*)$": "<rootDir>/src/$1",6 },7 transformIgnorePatterns: ["/node_modules/"],8 // setupFiles: [
9 // "./tests/unit/setup.ts",10 // ],11 };
不要太在意路径,为了阅读简单,我调整了它们...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)