Skip to content

Conversation

outslept
Copy link
Contributor

image

vs

image

@outslept outslept marked this pull request as draft August 12, 2025 20:46
@outslept
Copy link
Contributor Author

outslept commented Aug 12, 2025

Seems picocolors posts extra ansi escape sequences. Investigating.

UPD: chalk disables colors in CI by default and picocolors doesn't. I'll add NO_COLOR to vitest.config

Copy link

codecov bot commented Aug 12, 2025

Codecov Report

❌ Patch coverage is 16.39676% with 413 lines in your changes missing coverage. Please review.
✅ Project coverage is 29.73%. Comparing base (719b3fd) to head (a375ca4).

Files with missing lines Patch % Lines
src/utils/clack/index.ts 26.31% 42 Missing ⚠️
src/nextjs/nextjs-wizard.ts 0.00% 38 Missing ⚠️
src/flutter/code-tools.ts 4.34% 22 Missing ⚠️
src/nuxt/sdk-setup.ts 0.00% 18 Missing ⚠️
src/nextjs/templates.ts 5.55% 17 Missing ⚠️
src/flutter/flutter-wizard.ts 0.00% 16 Missing ⚠️
src/sourcemaps/tools/wrangler.ts 6.25% 15 Missing ⚠️
src/remix/sdk-setup.ts 6.66% 14 Missing ⚠️
src/sourcemaps/sourcemaps-wizard.ts 6.66% 14 Missing ⚠️
src/angular/sdk-setup.ts 7.14% 13 Missing ⚠️
... and 37 more
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1069      +/-   ##
==========================================
+ Coverage   29.64%   29.73%   +0.08%     
==========================================
  Files         128      128              
  Lines       14686    14630      -56     
  Branches      969      969              
==========================================
- Hits         4354     4350       -4     
+ Misses      10315    10263      -52     
  Partials       17       17              
Flag Coverage Δ
unit-tests 29.73% <16.39%> (+0.08%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@outslept outslept marked this pull request as ready for review August 12, 2025 20:59
@outslept
Copy link
Contributor Author

Alright, the problem should be fixed. Could you please re-run the jobs? It failed due to flaky e2e tests unrelated to this change (had the same-ish behavior in #1068).

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I re-ran e2e tests. If the same test fails (cloudflare source maps), I need to strip out ansi color/format characters in my testing library that's used by the cloudflare source maps e2e test. I'm surprised we handle this in the other e2e tests though 😅

EDIT: looks like that's the problem. Unfortunately, we can't set NO_COLOR=1 during build for the e2e tests because they use the same build artifacts that we end up publishing (kinda the point of an e2e test xD). So I'll fix this in clifty in a bit.

Update: Not so sure if this is the problem anymore. Still need to do some more debugging but don't have time right now. If you get a chance, you could try running the cloudflare wrangler source maps e2e test locally and check if you spot any obvious problems. Will revisit this as soon as I can.

@outslept
Copy link
Contributor Author

outslept commented Aug 16, 2025

I duplicated the branch to create a PR in my own fork to check the CI logs first before providing feedback. The CI log shows the issue - clifty is expecting Installing @sentry/cli but receiving [35m◒[39m Installing [1m[36m@sentry/cli[39m[22m with [1mYarn V1[22m... with ANSI escape sequences that it cannot parse, causing the problem.

If you'd like to provide striping on clifty side, you could use Node.js built-in util.stripVTControlCharacters(str) (https://nodejs.org/api/util.html#utilstripvtcontrolcharactersstr) to strip ANSI sequences. It should apply to this https://github.com/Lms24/clifty/blob/0d7ae7c4aa8442cd1ce6b75edd6d41fd57e32fbc/packages/clifty/src/scenarioBuilder.ts#L159-L178

And it would look like this:

child.stdout.on("data", (data) => {
  const cleanData = stripVTControlCharacters(data.toString());
  this.#stdoutBuffer += cleanData;
  this.output.dispatchEvent(
    new CustomEvent("stdout", { detail: cleanData })
  );
  if (this.#testEnv.debug) {
    console.log(this.#stdErrBuffer);
  }
});
child.stderr.on("data", (data) => {
  const cleanData = stripVTControlCharacters(data.toString());
  this.#stdErrBuffer += cleanData;
  this.output.dispatchEvent(
    new CustomEvent("stderr", { detail: cleanData })
  );

  if (this.#testEnv.debug) {
    console.log(this.#stdErrBuffer);
  }
});

@outslept
Copy link
Contributor Author

outslept commented Aug 16, 2025

This is the workflow run from my fork (content doesn't differ from this branch, I just removed NO_COLOR from vitest config): https://github.com/outslept/sentry-wizard/actions/runs/17007457214/job/48219026060?pr=1

Open logs and look for (cloudflare) :

2025-08-16T10:38:59.2196791Z Waiting for: 
2025-08-16T10:38:59.2197230Z Installing @sentry/cli

And all the ansi hell

2025-08-16T10:38:59.2327378Z �[999D�[J�[35m◒�[39m  Installing �[1m�[36m@sentry/cli�[39m�[22m with �[1mYarn V1�[22m�[999D�[J�[35m◐�[39m  Installing �[1m�[36m@sentry/cli�[39m�[22m with �[1mYarn V1�[22m�[999D�[...

The reason there are so many ANSI codes is because the CLI spinner updates every x ms with new animation frames, and each update gets accumulated in stdout buffer. While clifty waits for the timeout, the spinner continuously outputs new frames with cursor movement commands and color codes, creating this ANSI sequence spam.

UPD: Maybe this is deeper than I assume. I'm trying to localize the issue, but couldn't provide a reproduction. For some reason it seems really easy on paper, but weird in practice. Weird, but I'll keep going.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants