start-server-and-test preview 'cypress run --e2e' not outputting expected code coverage when testing against vite preview server
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- cypress, javascript, node.js, typescript
- Lĩnh vực
- testing-qa, tooling
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện vấn đề với script test:dist:e2e, script này chạy instrument-build, vite preview và cypress run --e2e. So sánh .nyc_output/out.json với coverage/coverage-final.json, sau đó kiểm tra cấu hình vite-plugin-istanbul được hiển thị và các log của coverage reporter. Hoàn tất khi lần chạy preview-server báo cáo các tệp ứng dụng đã được instrument như mong đợi, bao gồm các component Vue được hiển thị trong đầu ra debug.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Debug Logs
code-coverage combined NYC options { 'report-dir': './coverage', reporter: [ 'lcov', 'clover', 'json', 'json-summary' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false } +0ms
code-coverage parsed sent coverage +0ms
code-coverage wrote coverage file /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output/out.json +4ms
code-coverage NYC file /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output/out.json has 13 key(s) +3s
code-coverage 1 key /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/HelloWorld.vue file path /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/HelloWorld.vue +0ms
code-coverage 2 key /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/App.vue file path /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/App.vue +0ms
code-coverage 3 key /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/WelcomeItem.vue file path /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/WelcomeItem.vue +0ms
code-coverage in file /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output/out.json all files are not found? false +1ms
code-coverage NYC file /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output/out.json has 13 key(s) +1ms
code-coverage calling NYC reporter with options { 'report-dir': '/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/coverage', reporter: [ 'lcov', 'clover', 'json', 'json-summary' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false, 'temp-dir': '/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output', tempDir: '/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/.nyc_output', reportDir: '/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/coverage' } +27ms
code-coverage current working directory is /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example +1ms
code-coverage after reporting, returning the report folder name /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/coverage +160ms
code-coverage Final coverage in /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/coverage/coverage-final.json +1ms
code-coverage There are 2 key(s) in /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/coverage/coverage-final.json +0ms
code-coverage ✅ /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/main.js statements covered 4/4 +0ms
code-coverage ⚠️ /Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/router/index.js statements covered 1/2 +0ms
Versions
- What is this plugin's version? If this is NOT the latest released version can you try the latest version, please?
- 3.10.0
- If the plugin worked before in version X, but stopped after upgrading to version Y, please try the released versions between X and Y to see where the breaking change was.
- What is Cypress version?
- 10.0.3
- What is your operating system?
- macOS Monterey v12.4
- What is the shell?
- zsh
- What is the Node version?
- 16.3.1
- What is the NPM version?
- 6.14.4
- How do you instrument your application? Cypress does not instrument web application code, so you need to do it yourself.
- Instrumentation is done via https://github.com/iFaxity/vite-plugin-istanbul. I'm using the following config for the vite-plugin-istanbul:
I use the following npm scripts:istanbul({ include: 'src/*', exclude: ['node_modules'], extension: ['.js', '.ts', '.vue'], /** * This allows us to omit the INSTRUMENT_BUILD env variable when running the production build via * npm run build. * More details below. */ requireEnv: false, /** * If forceBuildInstrument is set to true, this will add coverage instrumentation to the * built dist files and allow the reporter to collect coverage from the (built files). * However, when forceBuildInstrument is set to true, it will not collect coverage from * running against the dev server: e.g. npm run dev. * * To allow collecting coverage from running cypress against the dev server as well as the * preview server (built files), we use an env variable, INSTRUMENT_BUILD, to set * forceBuildInstrument to true when running against the preview server via the * pretest:dist:e2e npm script. * * When you run `npm run build`, the INSTRUMENT_BUILD env variable is omitted from the npm * script which will result in forceBuildInstrument being set to false, ensuring your * dist/built files for production do not include coverage instrumentation code. */ forceBuildInstrument: Boolean(process.env.INSTRUMENT_BUILD) }),"preview": "vite preview --port 4173", "instrument-build": "INSTRUMENT_BUILD=true vite build", "test:dist:e2e": "npm run instrument-build && start-server-and-test preview http://127.0.0.1:4173/ 'cypress run --e2e'", - When running tests, if you open the web application in regular browser, and open DevTools, do you see
window.__coverage__object? Can you paste a screenshot?- Yes
- Is there
.nyc_outputfolder? Is there.nyc_output/out.jsonfile. Is it empty? Can you paste at least part of it so we can see the keys and file paths?- Yes. Here is partial contents of
.nyc_output/out.json
- Yes. Here is partial contents of
Contents
{
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/HelloWorld.vue": {
"path": "/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/HelloWorld.vue",
"statementMap": {
"0": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 81
}
},
"1": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 80
}
},
"2": {
"start": {
"line": 4,
"column": 19
},
"end": {
"line": 4,
"column": 41
}
},
"3": {
"start": {
"line": 5,
"column": 19
},
"end": {
"line": 5,
"column": 37
}
},
"4": {
"start": {
"line": 6,
"column": 33
},
"end": {
"line": 18,
"column": 7
}
},
"5": {
"start": {
"line": 6,
"column": 65
},
"end": {
"line": 18,
"column": 6
}
},
"6": {
"start": {
"line": 21,
"column": 18
},
"end": {
"line": 41,
"column": 1
}
},
"7": {
"start": {
"line": 33,
"column": 0
},
"end": {
"line": 38,
"column": 1
}
},
"8": {
"start": {
"line": 34,
"column": 2
},
"end": {
"line": 37,
"column": 5
}
}
},
"fnMap": {
"0": {
"name": "(anonymous_0)",
"decl": {
"start": {
"line": 3,
"column": 21
},
"end": {
"line": 3,
"column": 22
}
},
"loc": {
"start": {
"line": 3,
"column": 27
},
"end": {
"line": 3,
"column": 80
}
},
"line": 3
},
"1": {
"name": "(anonymous_1)",
"decl": {
"start": {
"line": 6,
"column": 46
},
"end": {
"line": 6,
"column": 47
}
},
"loc": {
"start": {
"line": 6,
"column": 65
},
"end": {
"line": 18,
"column": 6
}
},
"line": 6
},
"2": {
"name": "(anonymous_2)",
"decl": {
"start": {
"line": 29,
"column": 2
},
"end": {
"line": 29,
"column": 3
}
},
"loc": {
"start": {
"line": 29,
"column": 17
},
"end": {
"line": 39,
"column": 1
}
},
"line": 29
},
"3": {
"name": "(anonymous_3)",
"decl": {
"start": {
"line": 33,
"column": 7
},
"end": {
"line": 33,
"column": 8
}
},
"loc": {
"start": {
"line": 33,
"column": 25
},
"end": {
"line": 38,
"column": 1
}
},
"line": 33
}
},
"branchMap": {},
"s": {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 1,
"8": 1
},
"f": {
"0": 1,
"1": 1,
"2": 1,
"3": 1
},
"b": {},
"inputSourceMap": {
"version": 3,
"file": null,
"sources": [
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/components/HelloWorld.vue"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAc;AAMZ;;;;;;;;;;"
},
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
"hash": "f710a38f152bbed0d4b1e1ff74ea0cca9668c0fa"
},
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/App.vue": {
"path": "/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/App.vue",
"statementMap": {
"0": {
"start": {
"line": 5,
"column": 32
},
"end": {
"line": 11,
"column": 12
}
},
"1": {
"start": {
"line": 12,
"column": 19
},
"end": {
"line": 12,
"column": 39
}
},
"2": {
"start": {
"line": 13,
"column": 32
},
"end": {
"line": 13,
"column": 56
}
},
"3": {
"start": {
"line": 14,
"column": 32
},
"end": {
"line": 14,
"column": 57
}
},
"4": {
"start": {
"line": 19,
"column": 18
},
"end": {
"line": 51,
"column": 1
}
},
"5": {
"start": {
"line": 24,
"column": 0
},
"end": {
"line": 48,
"column": 1
}
},
"6": {
"start": {
"line": 25,
"column": 2
},
"end": {
"line": 47,
"column": 9
}
},
"7": {
"start": {
"line": 32,
"column": 36
},
"end": {
"line": 34,
"column": 13
}
},
"8": {
"start": {
"line": 38,
"column": 36
},
"end": {
"line": 40,
"column": 13
}
}
},
"fnMap": {
"0": {
"name": "(anonymous_0)",
"decl": {
"start": {
"line": 21,
"column": 2
},
"end": {
"line": 21,
"column": 3
}
},
"loc": {
"start": {
"line": 21,
"column": 17
},
"end": {
"line": 49,
"column": 1
}
},
"line": 21
},
"1": {
"name": "(anonymous_1)",
"decl": {
"start": {
"line": 24,
"column": 7
},
"end": {
"line": 24,
"column": 8
}
},
"loc": {
"start": {
"line": 24,
"column": 25
},
"end": {
"line": 48,
"column": 1
}
},
"line": 24
},
"2": {
"name": "(anonymous_2)",
"decl": {
"start": {
"line": 32,
"column": 30
},
"end": {
"line": 32,
"column": 31
}
},
"loc": {
"start": {
"line": 32,
"column": 36
},
"end": {
"line": 34,
"column": 13
}
},
"line": 32
},
"3": {
"name": "(anonymous_3)",
"decl": {
"start": {
"line": 38,
"column": 30
},
"end": {
"line": 38,
"column": 31
}
},
"loc": {
"start": {
"line": 38,
"column": 36
},
"end": {
"line": 40,
"column": 13
}
},
"line": 38
}
},
"branchMap": {},
"s": {
"0": 1,
"1": 1,
"2": 1,
"3": 1,
"4": 1,
"5": 1,
"6": 1,
"7": 2,
"8": 2
},
"f": {
"0": 1,
"1": 1,
"2": 2,
"3": 2
},
"b": {},
"inputSourceMap": {
"version": 3,
"file": null,
"sources": [
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/App.vue"
],
"names": [],
"mappings": ";;;;;;;;;;;;;;;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnD,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;;;;;AAFtC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"
},
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
"hash": "0b4cf991df8ac6ed045ee01fa94c5627575a0eb3"
},
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/router/index.js": {
"path": "/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/router/index.js",
"statementMap": {
"0": {
"start": {
"line": 4,
"column": 15
},
"end": {
"line": 21,
"column": 2
}
},
"1": {
"start": {
"line": 18,
"column": 23
},
"end": {
"line": 18,
"column": 55
}
}
},
"fnMap": {
"0": {
"name": "(anonymous_0)",
"decl": {
"start": {
"line": 18,
"column": 17
},
"end": {
"line": 18,
"column": 18
}
},
"loc": {
"start": {
"line": 18,
"column": 23
},
"end": {
"line": 18,
"column": 55
}
},
"line": 18
}
},
"branchMap": {},
"s": {
"0": 1,
"1": 0
},
"f": {
"0": 0
},
"b": {},
"inputSourceMap": {
"version": 3,
"file": null,
"sources": [
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/router/index.js"
],
"names": [],
"mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3D,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC5C;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC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,CAAC,CAAC,CAAC;AACvD,CAAC,CAAC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AACH,CAAC,CAAC;AACF;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;"
},
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
"hash": "560bf5840da55511c282ef9773b61bdc32ad2097"
},
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/main.js": {
"path": "/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/main.js",
"statementMap": {
"0": {
"start": {
"line": 7,
"column": 12
},
"end": {
"line": 7,
"column": 26
}
},
"1": {
"start": {
"line": 9,
"column": 0
},
"end": {
"line": 9,
"column": 22
}
},
"2": {
"start": {
"line": 10,
"column": 0
},
"end": {
"line": 10,
"column": 15
}
},
"3": {
"start": {
"line": 12,
"column": 0
},
"end": {
"line": 12,
"column": 17
}
}
},
"fnMap": {},
"branchMap": {},
"s": {
"0": 1,
"1": 1,
"2": 1,
"3": 1
},
"f": {},
"b": {},
"inputSourceMap": {
"version": 3,
"file": null,
"sources": [
"/Users/jankordbrett/repos/open-source/vite-vue-cypress-code-coverage-example/src/main.js"
],
"names": [],
"mappings": "AAAA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACnC;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC3B,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC7B;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAC1B;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AACf;AACA,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;"
},
"_coverageSchema": "1a1c01bbd47fc00a2c39e90264f33305004495a9",
"hash": "538bc94b495e51823e3d624a823d5d6308c17cce"
},
}
You can view the full contents here:
https://github.com/bjankord/vite-vue-cypress-code-coverage-example/blob/main/.nyc_output/out.json
- Do you have any custom NYC settings in
package.json(nycobject) or in other NYC config files- No, none that I'm aware of
- Do you run Cypress tests in a Docker container?
- No
Describe the bug
When instrumenting my Vite + Vue project with https://github.com/iFaxity/vite-plugin-istanbul and running start-server-and-test preview 'cypress run --e2e' I'd expect to see coverage reports for the following files:
- src/App.vue
- src/main.js
- src/components/HelloWorld.vue
- src/components/TheWelcome.vue
- src/components/WelcomeItem.vue
- src/components/icons/IconCommunity.vue
- src/components/icons/IconDocumentation.vue
- src/components/icons/IconEcosystem.vue
- src/components/icons/IconSupport.vue
- src/components/icons/IconTooling.vue
- src/router/index.js
What I actually see is coverage reports for the following files:
- src/main.js
- src/router/index.js
If I instead run the vite dev server instead of the preview server and then run cypress run --e2e in a separate terminal window, I am able to get coverage reports for the following files:
- src/App.vue
- src/main.js
- src/components/HelloWorld.vue
- src/components/TheWelcome.vue
- src/components/WelcomeItem.vue
- src/components/icons/IconCommunity.vue
- src/components/icons/IconDocumentation.vue
- src/components/icons/IconEcosystem.vue
- src/components/icons/IconSupport.vue
- src/components/icons/IconTooling.vue
- src/router/index.js
I believe this issue may span across @cypress/code-coverage and vite and may be more on the vite side with how it bundles JS for the preview server but I'd figured I'd post here incase anyone was able to help debug.
My original thought was that vite build was code splitting the JS files causing the code coverage report to not show all the files that I'd expect.
I've tried adding the following to my vite.config.js file to generate just 1 JS file:
build: {
sourcemap: true,
rollupOptions: {
output: {
manualChunks: () => 'bundle',
},
},
},
And while that does output just 1 index JS file, the coverage report did not change, I still see reports only for the following files when running the test:dist:e2e npm script in my example repo.
- src/main.js
- src/router/index.js
I see in my there are 13 keys matching the files I'd expect to see coverage reports in .nyc_out/out.json, but there are only 2 keys in coverage/coverage-final.json, the 2 files that actually get a coverage report. I'm unsure what causes this difference though.
Link to the repo
https://github.com/bjankord/vite-vue-cypress-code-coverage-example
- Ngôn ngữ chính
- TypeScript
- Star
- 440
- Fork
- 114
- Merge trung bình
- 42 phút
- Pull request đã merge (30 ngày)
- 19
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của cypress-io/code-coverage
-
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 40/100
cypress-io/code-coverage#1018 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
cypress-io/code-coverage#993 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
cypress-io/code-coverage#967 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 45/100
cypress-io/code-coverage#959 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
performance
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
cypress-io/code-coverage#933 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của cypress-io/code-coverage
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
vercel-labs/durable-harness#53 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug]: Redesign tab bars ignore clicks on Linux: hidden chat layers keep window drag regionsCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
Maintainer thường phản hồi trong vòng 1 ngày
-
experiência: a doc manda subir para o Micro do Supabase, mas não diz que exige plano pago nem quanto custaCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea/docs area/ui enhancement
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 88/100
melgarafael/DeskcommCRM#4098 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
kerti/balances-v2#801 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
lesson-submission pending-review
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 84/100
Ikalus1988/MisakaNet#4510 ·
Maintainer thường phản hồi trong vòng 1 ngày