swagger-api / swagger-ui

Swagger UI is a collection of HTML, JavaScript, and CSS assets that dynamically generate beautiful documentation from a Swagger-compliant API.
https://swagger.io
Apache License 2.0
26.61k stars 8.97k forks source link

vitest breaks due to Scarf analytics reporting #10197

Closed SheldonWBM closed 2 weeks ago

SheldonWBM commented 2 weeks ago

Cause: This is likely due to PR #10194

Issue: When I run Vitest, using yarn, I have the following error

❯ .yarn/unplugged/@scarf-scarf-npm-1.3.0-df555ef968/node_modules/@scarf/scarf/test/report.test.js (7)
   ❯ Reporting tests (7)
     ⠙ [ beforeAll ]
     ↓ Logging rate limit check [skipped]
     ↓ Redact sensitive data [skipped]
     ↓ Intermediate packages can disable Scarf for their dependents [skipped]
     ↓ Disable when package manager is yarn [skipped]
     ↓ Configurable for top level installs, and enabled for global installs [skipped]
     ↓ Can parse example git rev-parse HEAD output [skipped]
     ↓ getGitShaFromRootPath resolves in test run of cloned repository [skipped]
.yarn/unplugged/@scarf-scarf-npm-1.3.0-df555ef968/node_modules/@scarf/scarf/test/report.test.js > Reporting tests
ReferenceError: jest is not defined

Workaround: In project's package.json, I tried

  "scarfSettings": {
    "defaultOptIn": false
  },

I also tried

  "scarfSettings": {
    "enabled": false
  },

Solutions

char0n commented 2 weeks ago

Hi @SheldonWBM,

Thanks for the report. The issue is being addressed in https://github.com/swagger-api/swagger-ui/pull/10204

char0n commented 2 weeks ago

Fixed in https://github.com/swagger-api/swagger-ui/releases/tag/v5.18.2

char0n commented 2 weeks ago

@SheldonWBM can you please confirm that https://github.com/swagger-api/swagger-ui/releases/tag/v5.18.2 no longer breaks Vitest?

SheldonWBM commented 2 weeks ago

Confirmed. Thank you for quickly resolving the issue.