hbenl / vscode-mocha-test-adapter

Mocha Test Adapter for the VS Code Test Explorer
MIT License
90 stars 31 forks source link

Test run shows negative run time #246

Open philipm-domuso opened 1 year ago

philipm-domuso commented 1 year ago

Type: Bug

In this suite of Mocha tests, one of the groups shows a negative, and very large run time: -139619942843ms

I don't see any messages in the logs of any of the output windows to this effect. The tests execute within milliseconds.

image Screenshot 2023-07-20 at 6 45 34 PM

VS Code version: Code 1.80.1 (Universal) (74f6148eb9ea00507ec113ec51c489d6ffb4b771, 2023-07-12T17:20:23.298Z) OS version: Darwin arm64 22.5.0 Modes:

System Info |Item|Value| |---|---| |CPUs|Apple M1 Max (10 x 24)| |GPU Status|2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
video_decode: enabled
video_encode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
webgpu: enabled| |Load (avg)|2, 2, 2| |Memory (System)|32.00GB (0.57GB free)| |Process Argv|--crash-reporter-id 37ac4b2d-63b4-4f00-959d-369c3bd49212| |Screen Reader|yes| |VM|0%|
Extensions (47) Extension|Author (truncated)|Version ---|---|--- vscode-file-peek|abi|1.0.1 vscode-sql-formatter|adp|1.4.4 nugetpackagemanagergui|ali|2.0.6 vscode-django|bat|1.10.0 vscode-markdownlint|Dav|0.51.0 vscode-eslint|dba|2.4.2 xml|Dot|2.5.1 gitlens|eam|14.1.1 EditorConfig|Edi|0.16.4 prettier-vscode|esb|9.19.0 macros|ged|1.2.1 vscode-pull-request-github|Git|0.68.1 vscode-mocha-test-adapter|hbe|2.14.1 vscode-test-explorer|hbe|2.21.1 csharpsortusings|jon|0.0.6 roslynator|jos|4.3.0 rainbow-csv|mec|3.7.0 prettify-json|moh|0.0.3 csharp|ms-|1.26.0 dotnet-interactive-vscode|ms-|1.0.4313020 isort|ms-|2023.10.1 python|ms-|2023.12.0 vscode-pylance|ms-|2023.7.30 jupyter|ms-|2023.6.1101941928 jupyter-keymap|ms-|1.1.2 jupyter-renderers|ms-|1.0.17 vscode-jupyter-cell-tags|ms-|0.1.8 vscode-jupyter-slideshow|ms-|0.1.5 remote-containers|ms-|0.299.0 remote-explorer|ms-|0.4.1 test-adapter-converter|ms-|0.1.8 sqltools|mtx|0.28.0 sqltools-driver-mssql|mtx|0.4.1 sqltools-driver-mysql|mtx|0.6.0 sqltools-driver-pg|mtx|0.5.1 sqltools-driver-sqlite|mtx|0.5.0 csv-to-table|php|1.4.0 Csharp-ASPNETCore|rah|1.11.0 vscode-thunder-client|ran|2.9.2 vscode-yaml|red|1.14.0 vscode-sort-json|ric|1.20.0 gruvbox-material|sai|6.5.2 intellicode-api-usage-examples|Vis|0.2.7 vscodeintellicode|Vis|1.2.30 vscodeintellicode-completions|Vis|1.0.22 vim|vsc|1.25.2 fig|wit|0.0.7 (9 theme extensions excluded)
A/B Experiments ``` vsliv368cf:30146710 vsreu685:30147344 python383:30185418 vspor879:30202332 vspor708:30202333 vspor363:30204092 vslsvsres303:30308271 vserr242cf:30382550 pythontb:30283811 vsjup518:30340749 pythonptprofiler:30281270 vsdfh931cf:30280410 vshan820:30294714 vstes263cf:30335440 vscod805cf:30301675 binariesv615:30325510 bridge0708:30335490 bridge0723:30353136 vsaa593cf:30376535 pythonvs932:30410667 vscaat:30438848 vsclangdf:30486550 c4g48928:30535728 dsvsc012:30540252 pynewext54:30695312 azure-dev_surveyone:30548225 2e4cg342:30602488 89544117:30613380 2i9eh265:30646982 showlangstatbar:30737416 vsctsb:30748421 03d35959:30757346 pythonfmttext:30731395 pythoncmvfstrcf:30756944 fixshowwlkth:30771522 showindicator:30785052 pythongtdpath:30769146 i26e3531:30792625 pythonnosm12tcf:30779713 pythonidxpt:30784022 pythonnoceb:30776495 e537b577:30786199 dsvsc013:30789517 ```
philipm-domuso commented 1 year ago

Perhaps in Reporter::getElapsedTime after the run time is computed in const elapsed = Date.now() - startTimes.get(id)!; we can check if it's negative and set it to 0 instead?