Mar*_*vic 3 typescript reactjs jestjs react-scripts
在构建的 React 项目create-react-app中,测试文件位于他们需要测试的代码旁边的同一文件夹中,如下所示:
|- /src/path
| |- List.tsx
| |- List.test.tsx
Run Code Online (Sandbox Code Playgroud)
尝试运行npx jest或使用 global 时jest,我得到以下结果:
No tests found
In C:\src\path
34 files checked.
testMatch: **\*test.tsx,**/*test.tsx,src\**\*.test.tsx,src/**/*.test.tsx,C:\src\path\src\**\*.test.tsx,C:\src\path\src\**\*.test.tsx - 0 matches
testPathIgnorePatterns: \\node_modules\\ - 34 matches
Pattern: - 0 matches
Run Code Online (Sandbox Code Playgroud)
运行npm test-这在转弯运行脚本react-scripts test从package.json-工作正常,并能够找到并运行项目中的所有测试(手表模式)。
知道如何解决这个问题吗?
10.15.06.4.12.1.3Windows 10 1809 17763.316module.exports = {
testMatch: [
'**\\*test.tsx',
'**/*test.tsx',
'src\\**\\*.test.tsx',
'src/**/*.test.tsx',
'<rootDir>\\src\\**\\*.test.tsx',
'<rootDir>/src/**/*.test.tsx',
'src/.*|(.|/)(.test).tsx?$'
],
};
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
7376 次 |
| 最近记录: |