out.json file generated without code informations
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- angular, cypress, node.js, typescript
- 领域
- testing-qa
调研方向
从 cypress/support/index.js、cypress/plugins/index.js、.babelrc、cypress.json,以及 package.json 中的 scripts 和 nyc 配置开始。重现 Cypress 警告,并检查是否存在 window.coverage,以及 .nyc_output/out.json 是否接收到 mappings 和 counters。完成的标准是生成的 coverage 数据包含代码信息,而不是空 map。
由索引模型根据 Issue 内容生成。
描述
Logs and screenshots
code-coverage coverage has 0 record(s) +0ms
coverage has the following first paths
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/main.ts +1ms
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/polyfills.ts +0ms
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/test.ts +0ms
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/app/app-routing.module.ts +0ms
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/app/app.component.ts +0ms
code-coverage adding empty coverage for file /home/user/dev/workspace/project/src/app/app.module.ts +0ms
...
code-coverage includeAllFiles saving updated file /home/user/dev/workspace/project/.nyc_output/out.json +0ms
code-coverage there are 113 keys in the file +0ms
code-coverage calling NYC reporter with options { 'report-dir': '/home/user/dev/workspace/project/cypress-coverage', reporter: [ 'json', 'lcov' ], extension: [ '.js', '.jsx', '.ts', '.tsx' ], excludeAfterRemap: false, extends: '@istanbuljs/nyc-config-typescript', include: [ 'src/**/*.ts' ], exclude: [ '**/*.d.ts', 'coverage/**', 'packages/*/test/**', 'test/**', 'test{,-*}.ts', '**/*{.,-}{test,spec}.ts', '**/__tests__/**', '**/node_modules/**', 'support-utils.js', 'task-utils.js' ], all: true, 'check-coverage': true, 'temp-directory': '.nyc_output', sourceMap: true, instrument: true, 'temp-dir': '/home/user/dev/workspace/project/.nyc_output', tempDir: '/home/user/dev/workspace/project/.nyc_output', reportDir: '/home/user/dev/workspace/project/cypress-coverage' } +20ms
code-coverage current working directory is /home/user/dev/workspace/project +0ms
Versions
Ubuntu 18.04.5 LTS
Node 14.15.4
NPM: 7.20.5
Angular: 12.0.1
eslint: 7.26.0
My package.json:
"scripts": {
...
"instrument": "npx nyc instrument --compact=false src",
"cypress:open": "ng serve cypress open",
...
},
"devDependencies": {
...
"@babel/core": "^7.14.3",
"@cypress/code-coverage": "^3.9.10",
"@istanbuljs/nyc-config-typescript": "^1.0.1",
"babel-plugin-istanbul": "^6.0.0",
"cypress": "^7.7.0",
"cypress-sonarqube-reporter": "^1.7.1",
"nyc": "^15.1.0",
...
},
,
"nyc": {
"extension": [
".js",
".jsx",
".ts",
".tsx"
],
"extends": "@istanbuljs/nyc-config-typescript",
"include": [
"src/**/*.ts"
],
"exclude": [
"**/*.d.ts",
"coverage/**",
"packages/*/test/**",
"test/**",
"test{,-*}.ts",
"**/*{.,-}{test,spec}.ts",
"**/__tests__/**",
"**/node_modules/**",
"support-utils.js",
"task-utils.js"
],
"all": true,
"check-coverage": true,
"temp-directory": ".nyc_output",
"sourceMap": true,
"instrument": true,
"report-dir": "cypress-coverage",
"reporter": [
"json",
"lcov"
]
}
No, I couldn't see the window.__coverage__ object in the console, as you can see in the printscreen: https://pasteboard.co/5bqIcB10m5xC.png
All the files in out.json file are like this:
"/home/user/dev/workspace/project/src/main.ts": {
"path": "/home/user/dev/workspace/project/src/main.ts",
"statementMap": {},
"fnMap": {},
"branchMap": {},
"s": {},
"f": {},
"b": {}
},
I'm executing Cypress localy.
Describe the bug
Cypress shows the message:
⚠️ Could not find any coverage information in your application
by looking at the window coverage object.
Did you forget to instrument your application?
See [code-coverage#instrument-your-application](https://github.com/cypress-io/code-coverage#instrument-your-application)
`[@cypress/code-coverage]`
I followed all the steps of configuration in the site above. I searched for people that had similar issue, tried all sugestions, but I didn't have success. The report is generated normally.
Here is my configuration:
cypress/support/index.js:
import '@cypress/code-coverage/support';
cypress/plugins/index.js:
module.exports = (on, config) => {
require('@cypress/code-coverage/task')(on, config);
return config;
};
.babelrc:
{
"plugins": ["istanbul"]
}
eslintrc.json:
....
"extends": [..., "next/babel"]
cypress.json:
{
"integrationFolder": "cypress/integration",
"supportFile": "cypress/support/index.js",
"videosFolder": "cypress/videos",
"screenshotsFolder": "cypress/screenshots",
"pluginsFile": "cypress/plugins/index.js",
"fixturesFolder": "cypress/fixtures",
"baseUrl": "http://localhost:4200",
"projectId": "XXXXX",
"reporter": "cypress-sonarqube-reporter",
"env": {
"BABEL_ENV": "e2e"
},
"chromeWebSecurity": false,
"reporterOptions": {
"outputDir": "./sonar",
"overwrite": true
}
}
- 主要语言
- TypeScript
- 星标
- 440
- 派生
- 114
- 平均合并
- 42 分钟
- 30 天内合并 PR
- 19
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
cypress-io/code-coverage 的其他 Issue
-
难度 3/5 半天 新手友好度 40/100
cypress-io/code-coverage#1018 ·
维护者通常 1 天内回复
-
难度 4/5 3-5 天 新手友好度 35/100
cypress-io/code-coverage#993 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
cypress-io/code-coverage#967 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 45/100
cypress-io/code-coverage#959 ·
维护者通常 1 天内回复
-
performance
难度 4/5 3-5 天 新手友好度 42/100
cypress-io/code-coverage#933 ·
维护者通常 1 天内回复
查看 cypress-io/code-coverage 的全部 Issue
相似的 Issue
-
Chip source filter and denial markers miss Storage rows when a Storage activity source is picked未关闭bug
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 77/100
omdsh-dev/DSH-better-sidebar#1141 ·
维护者通常 2 天内回复
-
desktop linux photos
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
Cleanup Setup可能已有人在做 @AlexanderKaran 今天认领。 未关闭documentation enhancement
难度 2/5 1-3 小时 新手友好度 64/100
e18e/framework-tracker#769 ·
维护者通常 1 天内回复
-
bug v2
难度 1/5 1 小时以内 新手友好度 88/100
modelcontextprotocol/servers#5483 ·
维护者通常 1 天内回复