如何解决开玩笑-未找到测试
我有具体情况。我有类似通用模块的东西,它定义了所有集成的通用行为,并且所有集成都将其用作库。在该通用模块中,我配置了玩笑和测试集。
万一通用模块链接(npm link
)到集成,一切都可以。但是,当直接从npm直接安装此通用模块时,jest无法找到任何测试。我想,有些文件被忽略了,但是我不希望找到任何可以解决这种情况的配置。
debug
模式下的最终配置如下:
{
"configs": [
{
"automock": false,"cache": true,"cacheDirectory": "/private/var/folders/mv/v_zhxfq113qf8d6vsf4ldwq80000gn/T/jest_dx","clearMocks": false,"coveragePathIgnorePatterns": [
"/node_modules/"
],"cwd": "<path>/Workspace/integration/my_integration","detectLeaks": false,"detectOpenHandles": false,"errorOnDeprecated": false,"extraGlobals": [],"forceCoverageMatch": [],"globals": {},"haste": {
"computeSha1": false,"throwOnModuleCollision": false
},"moduleDirectories": [
"node_modules"
],"moduleFileExtensions": [
"js","json","jsx","ts","tsx","node"
],"moduleNameMapper": [],"modulePathIgnorePatterns": [],"name": "24eedccdafdba030f3d9209ab1064c8e","prettierPath": "prettier","resetMocks": false,"resetModules": false,"restoreMocks": false,"rootDir": "<path>/Workspace/integration/my_integration/node_modules/common_module/tests/api","roots": [
"<path>/Workspace/integration/my_integration/node_modules/common_module/tests/api"
],"runner": "jest-runner","setupFiles": [],"setupFilesAfterEnv": [],"skipFilter": false,"slowTestThreshold": 5,"snapshotSerializers": [],"testEnvironment": "<path>/Workspace/integration/my_integration/node_modules/jest-environment-node/build/index.js","testEnvironmentOptions": {},"testLocationInResults": false,"testMatch": [
"**/__tests__/**/*.[jt]s?(x)","**/?(*.)+(spec|test).[tj]s?(x)"
],"testPathIgnorePatterns": [
"/node_modules/"
],"testRegex": [],"testRunner": "<path>/Workspace/integration/my_integration/node_modules/jest-jasmine2/build/index.js","testURL": "http://localhost","timers": "real","transform": [],"transformIgnorePatterns": [
"/node_modules/","\\.pnp\\.[^\\/]+$"
],"watchPathIgnorePatterns": []
}
],"globalConfig": {
"bail": 0,"changedFilesWithAncestor": false,"collectCoverage": false,"collectCoverageFrom": [],"coverageDirectory": "<path>/Workspace/integration/my_integration/node_modules/common_module/coverage","coverageProvider": "babel","coverageReporters": [
"json","text","lcov","clover"
],"expand": false,"findRelatedTests": false,"forceExit": false,"json": false,"lastCommit": false,"listTests": false,"logHeapUsage": false,"maxConcurrency": 5,"maxWorkers": 7,"noStackTrace": false,"nonFlagArgs": [],"notify": false,"notifyMode": "failure-change","onlyChanged": false,"onlyFailures": false,"passWithNoTests": false,"projects": [],"runTestsByPath": false,"testFailureExitCode": 1,"testPathPattern": "","testSequencer": "<path>/Workspace/integration/my_integration/node_modules/@jest/test-sequencer/build/index.js","updateSnapshot": "new","useStderr": false,"verbose": true,"watch": false,"watchAll": false,"watchman": true
},"version": "26.4.0"
}
所有测试均在路径<path>/Workspace/integration/my_integration/node_modules/common_module/tests/api
上定义为,例如something.test.js
。
控制台将始终显示:
No tests found,exiting with code 1
Run with `--passWithNoTests` to exit with code 0
No files found in <path>/Workspace/integration/my_integration/node_modules/common_module/tests/api.
Make sure Jest's configuration does not exclude this directory.
To set up Jest,make sure a package.json file exists.
Jest Documentation: facebook.github.io/jest/docs/configuration.html
Pattern: - 0 matches
npm ERR! Test failed. See above for more details.
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。