denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
93.79k stars 5.22k forks source link

Crash when running deno coverage #15023

Closed coderaiser closed 1 year ago

coderaiser commented 2 years ago
Warning deno task is unstable and may drastically change in the future
Task coverage deno coverage coverage --exclude=test
cover file:///Users/coderaiser/redline/loader.js ... 100.000% (23/23)

============================================================
Deno has panicked. This is a bug in Deno. Please report this
at https://github.com/denoland/deno/issues/new.
If you can reliably reproduce this panic, include the
reproduction steps and re-run with the RUST_BACKTRACE=1 env
var set and include the backtrace in your report.

Platform: macos x86_64
Version: 1.23.1
Args: ["/Users/coderaiser/.deno/bin/deno", "coverage", "coverage", "--exclude=test"]

thread 'main' panicked at 'The specified byte index 287 was greater than the text length of 274.', /Users/runner/.cargo/registry/src/github.com-1ecc6299db9ec823/text_lines-0.4.1/src/lib.rs:237:7
stack backtrace:
   0: _rust_begin_unwind
   1: core::panicking::panic_fmt
   2: text_lines::TextLines::line_index
   3: deno::tools::coverage::cover_files::{{closure}}
   4: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   5: deno::main::{{closure}}
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: deno_runtime::tokio_util::run_basic
   8: deno::main
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

Here is deno.json:

{
    "tasks": {
        "test": "deno test --coverage=coverage loader.spec.js --allow-net",
        "coverage": "deno coverage coverage --exclude=test"
    },
     "options": {
      "useTabs": false,
      "lineWidth": 80,
      "indentWidth": 4,
      "singleQuote": true,
      "proseWrap": "preserve"
    }
}

Also would be great if Deno remove old coverage, after couple runs I have a bunch of unrelated files:

image

dsherret commented 2 years ago

This isn't deno task related, but deno coverage. Does it occur when you remove the old coverage files? You need to clear those out manually each time.

bartlomieju commented 2 years ago

Please provide an example code that caused this panic.

coderaiser commented 2 years ago

You need to clear those out manually each time.

I don't need two clear the things manually each time. Take a look at ESCover it produces one file for coverage: coverage/lcov.info, this is standard that come from first implementation of lcov and supported by services like coveralls and any other and just rewrite it on each run. This is as simple :).

The format of lcov is also very simple and it can be used for reporting as well, and all this garbage produced by V8 just don't needed, and should be collected :) (and removed before run).

Please provide an example code that caused this panic.

It disappear, I can't reproduce it anymore. The thing is Deno begged me so much about reporting the bug, so I could not hold on.

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.