【发布时间】:2017-05-13 16:16:37
【问题描述】:
出于某种原因,通过 Visual Studio 代码运行 jest 会返回类似于以下内容的内容:
running command> jest --no-cache
No tests found
In c:\Users\gusta\Documents\ts
992 files checked.
testMatch: **/__tests__/**/*.js?(x),**/?(*.)(spec|test).js?(x) - 121 matches
testPathIgnorePatterns: \\node_modules\\ - 7 matches
Pattern: "" - 0 matches
但是,当从命令行运行测试时,它可以很好地解决测试。
C:\Users\gusta\Documents\ts>jest --no-cache
PASS src\__test__\some-component.test.jsx (6.812s)
在尝试在 VSCode 中进行调试时会发生这种情况,而且在运行任务时也会发生这种情况。我的 tasks.json 看起来像这样:
{
"version": "0.1.0",
"tasks": [
{
"taskName": "jest",
"command": "jest",
"args": [
"--no-cache"
],
"isShellCommand": true,
"echoCommand": true,
"showOutput": "always"
}
]
}
我的 package.json:
{
"name": "badgeexplorerts",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"android": "yarn run haul start -- --platform android",
"test": "jest"
},
"dependencies": {
"@types/jest": "^19.2.3",
"react": "~15.4.1",
"react-native": "0.42.3",
"ts-loader": "^2.0.3",
"typescript": "^2.2.2"
},
"devDependencies": {
"@types/react": "^15.0.24",
"@types/react-native": "^0.43.12",
"babel-jest": "^20.0.0",
"babel-loader": "^7.0.0",
"babel-preset-es2015": "^6.24.1",
"haul-cli": "^0.5.0",
"jest": "^20.0.0",
"react-test-renderer": "~15.4.1",
"ts-jest": "^20.0.2"
},
"jest": {
"preset": "react-native"
}
}
有人知道发生了什么吗?我的VSCode版本是1.12.1
【问题讨论】:
标签: react-native visual-studio-code jestjs