Skip to content

Conversation

@Sakthieswaran-tech
Copy link
Contributor

@Sakthieswaran-tech Sakthieswaran-tech commented Oct 18, 2025

  1. Display questions when when returns { ask: false, display: true } without adding to answers.
  2. Fully skip questions when when returns { ask: false, display: false } or false.
  3. Added tests to cover these cases.

@codecov
Copy link

codecov bot commented Oct 18, 2025

Codecov Report

❌ Patch coverage is 93.33333% with 4 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@a171f0e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
packages/inquirer/src/ui/skipped-renderer.ts 90.69% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1853   +/-   ##
=======================================
  Coverage        ?   94.77%           
=======================================
  Files           ?       38           
  Lines           ?     1587           
  Branches        ?      466           
=======================================
  Hits            ?     1504           
  Misses          ?       80           
  Partials        ?        3           

☔ 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.

@Sakthieswaran-tech Sakthieswaran-tech force-pushed the feature/display-skipped-questions branch 2 times, most recently from fe5866b to 7f04251 Compare October 18, 2025 11:41
@Sakthieswaran-tech
Copy link
Contributor Author

Hey @SBoudrias , I’ve added more test cases and all checks are passing. Could you take a look when you get a chance and let me know if anything needs changes?

Copy link
Owner

@SBoudrias SBoudrias left a comment

Choose a reason for hiding this comment

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

The PR is a little big, so I didn't review all of it in depth yet. Here's a few early thoughts to streamline the code a little.

@Sakthieswaran-tech Sakthieswaran-tech force-pushed the feature/display-skipped-questions branch 2 times, most recently from 8e76e3c to 5b30e81 Compare October 28, 2025 08:09
@Sakthieswaran-tech
Copy link
Contributor Author

Rebased with latest main.
Incorporated all the review changes (including normalization and theme updates).
The reviewed fixes are now part of the existing commits after rebase.

@Sakthieswaran-tech
Copy link
Contributor Author

Hi @SBoudrias , I’ve made the requested changes and resolved the conflicts. Please take a look when you have some time and let me know if I need to make any further changes. Thanks!

@Sakthieswaran-tech
Copy link
Contributor Author

Hi! Just checking in on this PR whenever you get a chance. Let me know if anything else is needed from my side.

@SBoudrias SBoudrias force-pushed the feature/display-skipped-questions branch from 219cc1e to 2b9d1b8 Compare January 10, 2026 20:07
Copy link
Owner

@SBoudrias SBoudrias left a comment

Choose a reason for hiding this comment

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

I did a slight refactoring pass on some core changes. Besides that, I think there's still a fair amount of work to properly consider how this works with plugins and how we respect user theme.

Comment on lines +25 to +26
const theme = makeTheme();
const prefix = typeof theme.prefix === 'string' ? theme.prefix : theme.prefix.idle;
Copy link
Owner

Choose a reason for hiding this comment

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

Doing here mean we're only support the default theme, whereas we should match the theme if one is provided by the user.

};

function renderLine(message: string, answerText: string) {
return theme.style.help(`${prefix} ${message} ${answerText}`);
Copy link
Owner

Choose a reason for hiding this comment

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

help likely isn't the right theme key to use here; it's not semantically correct. We should add a new key to cover skipped question lines.

});

it('should display skipped question when `when` returns { ask: false, display: true }', async () => {
const writeSpy = vi.spyOn(process.stdout, 'write').mockImplementation(() => true);
Copy link
Owner

Choose a reason for hiding this comment

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

I think it'll be cleaner here to reuse the BufferedStream from packages/testing/src/index.ts to collect the writes.

Comment on lines +29 to +33
confirm: (question: TypedQuestion) => {
const defaultVal = question.default;
const answerText = defaultVal === true ? 'Yes' : defaultVal === false ? 'No' : '';
return renderLine(question.message.toString(), answerText);
},
Copy link
Owner

Choose a reason for hiding this comment

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

I don't have a good suggestion right now, but implementing rendering here while the actual rendering is in other package isn't great...

Ideally rendering should be consistent and provided by each prompt.

},

default: (question: TypedQuestion) => {
const answerText = question.default !== undefined ? String(question.default) : '';
Copy link
Owner

Choose a reason for hiding this comment

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

Given default handle ALL prompts - not just the core ones within Inquirer, I don't think we can safely assume default can be stringified; for all we know default can be an object or an array.

},

editor: (question: TypedQuestion) => {
const answerText = question.default !== undefined ? '[Default Content]' : '';
Copy link
Owner

Choose a reason for hiding this comment

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

What user value does [Default Content] provide here? (same with PASSWORD SET later.)

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