CypressError: `cy.task('coverageReport')` failed - 'path' must be a string or Uint8Array
Maintainer thường phản hồi trong vòng 1 ngày
@lmiller1990 đang làm issue này rồi.
Từ ngày 12/7/2023.
Đánh giá
Issue này chưa được đánh giá.
Mô tả
Logs and screenshots
DEBUG=code-coverage yarn cypress:run
App test suite
code-coverage parsed sent coverage +0ms
code-coverage wrote coverage file /Volumes/Projects/work/example/.nyc_output/out.json +9ms
code-coverage NYC file /Volumes/Projects/work/example/.nyc_output/out.json has 4 key(s) +4s
code-coverage 1 key /Volumes/Projects/work/example/commonjsHelpers.js file path /Volumes/Projects/work/example/commonjsHelpers.js +0ms
code-coverage 2 key /Volumes/Projects/work/example/src/routes/App.tsx file path /Volumes/Projects/work/example/src/routes/App.tsx +0ms
code-coverage 3 key /Volumes/Projects/work/example/src/assets/styles/index.ts file path /Volumes/Projects/work/example/src/assets/styles/index.ts +0ms
code-coverage in file /Volumes/Projects/work/example/.nyc_output/out.json all files are not found? false +4ms
code-coverage NYC file /Volumes/Projects/work/example/.nyc_output/out.json has 4 key(s) +1ms
code-coverage ⚠️ cannot find file /Volumes/Projects/work/example/commonjsHelpers.js with hash 9651d8954bbfc1d463a64b666e5bd9644ac85cc1 +1ms
code-coverage calling NYC reporter with options { 'report-dir': '/Volumes/Projects/work/example/coverage', reporter: [ 'lcov', 'clover', 'json', 'json-summary' ], extension: [ '.js', '.cjs', '.mjs', '.ts', '.tsx', '.jsx' ], excludeAfterRemap: false, 'temp-dir': '/Volumes/Projects/work/example/.nyc_output', tempDir: '/Volumes/Projects/work/example/.nyc_output', reportDir: '/Volumes/Projects/work/example/coverage' } +58ms
code-coverage current working directory is /Volumes/Projects/work/example +2ms
1) "after all" hook: generateReport for "should check app is rendering correctly"
0 passing (679ms)
1 failing
1) App test suite
"after all" hook: generateReport for "should check app is rendering correctly":
CypressError: `cy.task('coverageReport')` failed with the following error:
> The argument 'path' must be a string or Uint8Array without null bytes. Received '/Volumes/Projects/work/example/coverage/lcov-report/example/\x00commonjsHelpers.js.html'
https://on.cypress.io/api/task
Because this error occurred during a `after all` hook we are skipping all of the remaining tests.
Although you have test retries enabled, we do not retry tests when `before all` or `after all` hooks fail
Versions
-
What is this plugin's version? If this is NOT the latest released version can you try the latest version, please?
"@cypress/code-coverage": "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.
Never tried this with another version before -
What is Cypress version?
10.3.0 -
What is your operating system?
OSX 12.1 -
What is the shell?
bash -
What is the Node version?
v16.14.0 -
What is the NPM version?
8.3.1 -
How do you instrument your application? Cypress does not instrument web application code, so you need to do it yourself.
vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
import { visualizer } from 'rollup-plugin-visualizer';
/**
* Vite configuration
*
* https://vitejs.dev/config/
*/
export default defineConfig({
plugins: [
react({
// Exclude storybook stories
exclude: /\.stories\.tsx?$/,
babel: {
plugins: ['istanbul'],
},
}),
visualizer({
filename: '.source-map-stats.html',
sourcemap: true,
}),
],
base: '/',
build: {
sourcemap: true,
},
css: {
preprocessorOptions: {
less: {
javascriptEnabled: true,
},
},
},
});
cypress.config.js
const { defineConfig } = require('cypress');
module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:4242',
// Test files
specPattern: 'cypress/e2e/**/*.spec.ts',
// Prevent flaky tests
retries: {
runMode: 2,
openMode: 0,
},
env: {
appPath: '/',
},
setupNodeEvents(on, config) {
require('@cypress/code-coverage/task')(on, config);
// include any other plugin code...
// It's IMPORTANT to return the config object
// with any changed environment variables
return config;
},
},
});
- 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?
-
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?
.nyc_output/out.json
https://github.com/xrutayisire/cypress-react-typescript-vite-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 custom settings -
Do you run Cypress tests in a Docker container?
No
Describe the bug
Terminal 1:
yarnyarn buildnpx serve -s dist -p 4242
Terminal 2:
DEBUG=code-coverage yarn cypress:run
⇒ Cypress Error appear
Link to the repo
https://github.com/xrutayisire/cypress-react-typescript-vite-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ự
-
Add: Shop On TV SDĐang mởcheck:passed streams:add
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug implicit-state
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
-
book-layout.spec fails when the similar-books rail holds other projects' booksCó thể đã có người làm @praetorianer777 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
praetorianer777/GoTome#373 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Tencent/tdesign-react#4465 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:cards enhancement ready-for-agent
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
fil-donadoni/tolaria#8883 ·
Maintainer thường phản hồi trong vòng 1 ngày