首页 > 解决方案 > 如何在 Windows 上使用 JHipster v5.8.2 运行客户端测试?

问题描述

我在 Windows 操作系统上使用 JHipster v5.8.2,并尝试通过运行以下命令来运行 Jest 客户端测试:

npm test

但我收到一条错误消息:

No tests found, exiting with code 1
Run with `--passWithNoTests` to exit with code 0
In C:\IdeaProjects\pomzen
  274 files checked.
  testMatch: 
C:/IdeaProjects/pomzen/src/test/javascript/spec/**\+(*.)+(spec.ts) - 0 
matches
  testPathIgnorePatterns: \\node_modules\\ - 274 matches
  testRegex:  - 0 matches
Pattern:  - 0 matches
npm ERR! Test failed.  See above for more details.

标签: jhipster

解决方案


我最近也遇到了这个问题。我从这里使用了解决方法: https ://github.com/DorianGrey/ng-webpack-template/pull/22/commits/fe95926607ed8bd01476c7d04b5b930a965ad282

使固定:

  1. 打开jest.conf.js文件
  2. 代替
testMatch: ['<rootDir>/src/test/javascript/spec/**/+(*.)+(spec.ts)']

testMatch: ['**/*.spec.ts']

推荐阅读