Skip to content

feat: Enhance interactive wizard for project creation and improve pac… - #1881

Open
dkalinovInfra wants to merge 1 commit into
masterfrom
dkalinov/wizard-tests
Open

dkalinovInfra wants to merge 1 commit into
masterfrom
dkalinov/wizard-tests

Conversation

@dkalinovInfra

Copy link
Copy Markdown
Contributor

Description

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

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 (47 on this branch: Angular 10, Blazor 24, jQuery 2, React 6, Web Components 5) with answers scripted through inquirerWrapperTesting.promptDelegates. Install, git and dotnet 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.
  • Angular projects created with ig new had no .prettierrc. Util.processTemplates globs without dot: true, so a template file named .prettierrc is never copied. Renamed to __dot__prettierrc, the convention the other dotfiles use; the schematics path already maps __dot__ to ..
  • 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) documents 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

  • igniteui-cli (packages/cli)
  • @igniteui/cli-core (packages/core)
  • @igniteui/angular-templates (packages/igx-templates)
  • @igniteui/angular-schematics (packages/ng-schematics)
  • @igniteui/mcp-server (packages/igniteui-mcp)

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 47/47, and Util-spec and packageManager-spec 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, and Angular projects get their .prettierrc; 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

Copy link
Copy Markdown

Coverage Status

coverage: 95.482% (+0.1%) from 95.379% — dkalinov/wizard-tests into master

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
record "$fw" "wizard" "$id" "PASS" "$((SECONDS - start))"
echo " ✓ wizard $id"
[ "$fw" = "blazor" ] && return 0
run_cli "$OUT/$dir" "$LOGS/$dir-config.log" config set disableAnalytics true
Comment thread scripts/smoke-test.sh
echo "=== $fw ($type) ==="

if [ -n "$WIZARD" ]; then
for id in $(node "$ROOT/scripts/smoke-wizard.mjs" list "$fw" "$WIZARD"); do
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.

3 participants