Skip to content

fix(cli): the interactive wizard no longer hangs on Windows when stdin is a pipe; adds automated tests for every wizard answer combination - #1881

Merged
kdinev merged 11 commits into
mstoyanova/angular-base-project-generationfrom
dkalinov/wizard-tests
Nov 11, 2026
Merged

kdinev merged 11 commits into
mstoyanova/angular-base-project-generationfrom
dkalinov/wizard-tests

Conversation

@dkalinovInfra

@dkalinovInfra dkalinovInfra commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Description

Adds automated tests for the interactive ig new wizard (ig new without a name) and fixes two bugs they found.

Stacked on #1854, which creates Angular projects with Angular's own ng new; review and merge that first.

Tests

  • spec/helpers/wizard-matrix.ts builds every answer combination the wizard offers from the registered templates: framework → project type → template (± authentication) → theme → each extra option. It also gives the answer to each prompt and the exact prompt sequence each combination should see, and samples combinations by coverage (each value, every pairs of values, or all). New templates and options are picked up automatically.
  • spec/acceptance/wizard-spec.ts runs the real wizard and templates for every combination (46 on this branch: Angular 10, Blazor 24, jQuery 2, React 5, Web Components 5) with answers scripted through inquirerWrapperTesting.promptDelegates. Install, git, dotnet and the Angular CLI (feat: regenerate Angular base project and update dependencies #1854's stubAngularCli()) are stubbed. A test fails on an unexpected prompt, an answer the prompt does not offer, or a different prompt order. It checks:
    • the generated ignite-ui-cli.json and template files
    • the exact dotnet new igb-blazor arguments for Blazor
    • the AI config files, rotating through none, the defaults, all agents/assistants, and copilot/vscode
  • scripts/smoke-wizard.mjs and scripts/smoke-test.sh --wizard each|pairs|all drive the real ig binary over a pipe (arrow keys and Enter), then the smoke test installs and builds each project. Without a TTY the CLI skips the AI config prompts and Blazor's "Run the app now", so only the spec covers those.

Fixes

  • ig hangs on Windows when its stdin is a pipe. Util.gitInit passed process.stdin to git, and PackageManager.installPackages passed stdio: ["inherit"] to npm. While the prompts were still reading that pipe, Git for Windows and npm blocked on startup. A new Util.childStdin() passes stdin only when it is a TTY, so behavior in a terminal (including Ctrl+C during install) is unchanged. The npx @angular/cli and npm install calls feat: regenerate Angular base project and update dependencies #1854 adds in _base/scaffold.ts get the same treatment.
    • installPackages now passes [childStdin, "ignore", "pipe"]: stdout is ignored explicitly (it was piped by default before), and stderr stays piped because Util.execSync looks for ^C in it to detect Ctrl+C, and npm's error text reaches the verbose log through it.
  • scripts/smoke-test.sh could not pass for Blazor. It required ignite-ui-cli.json, which dotnet-scaffolded projects don't have, and ran dotnet build at the project root, which fails with MSB1003 for Server hosting because there is no root .sln.

The smoke-test skill (.agents/skills/igniteui-cli-smoke-test/SKILL.md) and the README's smoke-test options table document the new --wizard mode and spec.

Related Issue

None.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • New feature (non-breaking change that adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Refactoring / code cleanup
  • Build / CI configuration change

Affected Packages

Checklist

  • I have tested my changes locally (npm run test)
  • I have built the project successfully (npm run build)
  • I have run the linter (npm run lint)
  • I have added/updated tests as needed
  • My changes do not introduce new warnings or errors

What was run instead:

  • Build: compiled with tsc. It reports three missing declarations (@types/resolve, @types/through2) in files this PR doesn't touch, from the local node_modules.
  • Lint: ESLint on the changed .ts files, clean. Locally, npm run lint crashes in ajv independently of this change.
  • Specs:
    • npm run jasmine: no new failures. The 25 failures in the Angular project scaffold, migration and AST transformer specs fail on master too.
    • The new wizard spec passes 46/46; Util-spec, packageManager-spec and angular-scaffold-spec (with a new spec for the stdin change) pass.
    • packageManager-spec's installPackages specs can time out when Jasmine randomizes the order, because a shared static installQueue keeps promises from earlier specs. That was already the case before this change; the repo's runner uses a fixed order, where they pass.
  • Smoke (scripts/smoke-test.sh --wizard pairs):
    • Blazor: 12/12 created through the wizard and built with dotnet build.
    • Web Components: 5/5 created, installed and built.
    • jQuery: 2/2 created and installed (no build script).
    • Angular and React: one project each driven end to end through the wizard, including npm install.

Additional Context

  • The Blazor empty-project work (dkalinov/blazor-empty-project) adds an empty template that passes --Empty. Whichever PR merges second needs wizard-spec.ts to expect --Empty for that template:
    if (s.template === "empty") {
    	expectedArgs.push("--Empty");
    }
    Both branches contain the same two Blazor fixes in scripts/smoke-test.sh.
  • Wizard runs post analytics events while the wizard runs, as the existing smoke ig new step does; analytics can only be turned off through config, which ig new refuses to run next to.
  • Suggested CHANGELOG line: fix(cli): the interactive wizard no longer hangs on Windows when stdin is a pipe; adds automated tests for every wizard answer combination.

🤖 Generated with Claude Code

…kage manager stdin handling

- Added comprehensive tests for the interactive `ig new` wizard covering various AI configurations and scenarios.
- Implemented a new script `smoke-wizard.mjs` to automate the wizard interaction, allowing for coverage of all answer combinations.
- Updated `PackageManager` to utilize a new `childStdin` method for better stdin handling based on terminal availability.
- Introduced a new `.prettierrc` configuration for consistent code formatting across projects.
- Enhanced smoke test scripts to support project creation through the interactive wizard, including detailed logging and result tracking.
- Added a new helper file `wizard-matrix.ts` to manage wizard scenarios and expected prompts.
Copilot AI balanced review requested due to automatic review settings November 6, 2026 09:31
@coveralls

coveralls commented Nov 6, 2026 •

Copy link
Copy Markdown

Coverage Status

Coverage is 95.659% — dkalinov/wizard-tests into mstoyanova/angular-base-project-generation. No base build found for mstoyanova/angular-base-project-generation.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The smoke test can silently succeed without running any scenarios when scenario listing fails, and its post-install configuration may invoke the published CLI instead of the checkout.

2 open issues
What changed in this PR

Adds automated coverage for the interactive ig new wizard and fixes project-generation issues exposed by that coverage.

Changes:

  • Adds template-driven wizard scenarios, acceptance tests, and pipe-driven smoke testing with selectable coverage.
  • Prevents child processes from inheriting piped stdin and ensures Angular projects receive .prettierrc.
  • Updates Blazor smoke checks and documents the new wizard-testing mode.
File Description
spec/​unit/​Util-spec.ts Tests child stdin selection and Git integration.
spec/​unit/​packageManager-spec.ts Updates expected package-install stdin handling.
spec/​helpers/​wizard-matrix.ts Generates wizard scenarios, answers, prompt sequences, and coverage samples.
spec/​acceptance/​wizard-spec.ts Checks wizard prompts, generated files, AI configuration, and Blazor arguments.
scripts/​smoke-wizard.mjs Drives the real wizard through piped keyboard input.
scripts/​smoke-test.sh Adds wizard mode and corrects Blazor scaffold/build checks.
packages/​igx-templates/​igx-ts/​projects/​_base/​files/​__dot__prettierrc Uses the dotfile placeholder so Angular scaffolding copies Prettier configuration.
packages/​core/​util/​Util.ts Adds TTY-aware child stdin handling and applies it to Git.
packages/​core/​packages/​PackageManager.ts Uses TTY-aware stdin for package installation.
.agents/​skills/​igniteui-cli-smoke-test/​SKILL.md Documents wizard acceptance coverage, smoke mode, and result naming.

Review effort: Balanced

Comment thread scripts/smoke-test.sh Resolved
Comment thread scripts/smoke-test.sh Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Note

This error may be related to your runner configuration. You can now configure runners for Copilot code review separately from Copilot cloud agent by creating a copilot-code-review.yml file with your setup steps. Read the docs for details.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread scripts/smoke-test.sh Resolved
Comment thread spec/unit/Util-spec.ts Resolved
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 08:59
Refactor childStdin test to properly handle isTTY property.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

…ov/wizard-tests

Stack the wizard tests on #1854: drop the .prettierrc rename (ng new now writes it),
pass childStdin to the Angular scaffold's npx/npm calls, stub the Angular CLI in
wizard-spec, run the checkout's lib/cli.js from smoke-wizard.mjs, and update the
packageManager-spec stdio expectations.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 09:09
@dkalinovInfra
dkalinovInfra changed the base branch from master to mstoyanova/angular-base-project-generation November 9, 2026 09:09
@dkalinovInfra
dkalinovInfra added this pull request to stack #1886 November 9, 2026 09:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Ignoring npm’s stderr discards failure diagnostics, so logged installation errors no longer explain dependency, authentication, or registry failures.

2 open issues

Review effort: Balanced

Remove stdout and stderr from execSync call to reduce console output.

Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 9, 2026 09:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The installPackages call supplies only one stdio entry instead of the expected three, causing all three updated specs to fail and leaving stdout/stderr suppression unspecified.

2 open issues
1 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 9, 2026 09:30

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

Ignoring stderr discards npm’s failure diagnostics and bypasses stderr-based interruption handling, leaving verbose installation errors without their underlying cause.

No open issues 🎉

2 resolved since last review

Review effort: Balanced

…mments

- installPackages passes [childStdin, "ignore", "pipe"] so Util.execSync can
  still detect ^C and npm's error text reaches the verbose log
- test that the Angular scaffold's npx/npm calls get childStdin()
- stub childStdin in the installPackages specs
- share the new/wizard step check in smoke-test.sh (finish_scaffold)
- document --wizard in the README and the Blazor/wizard artifact check in the smoke-test skill

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dkalinovInfra dkalinovInfra changed the title feat: Enhance interactive wizard for project creation and improve pac… fix(cli): the interactive wizard no longer hangs on Windows when stdin is a pipe; adds automated tests for every wizard answer combination Nov 9, 2026
- Blazor scaffold passes only when a .csproj exists, not just the folder
- detect .slnx as well as .sln before choosing the build target
- reject --wizard combined with -p, --templates, --all-projects or --isolate
- drop duplicate local declaration in run_framework
- simplify the isTTY save/restore in the childStdin spec

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kdinev
kdinev merged commit 7b88932 into master Nov 11, 2026
4 checks passed
@kdinev
kdinev deleted the dkalinov/wizard-tests branch November 11, 2026 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants