Skip to content

feat(yeoman-ui): implement generator progress notifications - #576

Open
korotkovao wants to merge 25 commits into
SAP:mainfrom
korotkovao:feat/yeoman-ui/generator-progress-notification
Open

feat(yeoman-ui): implement generator progress notifications#576
korotkovao wants to merge 25 commits into
SAP:mainfrom
korotkovao:feat/yeoman-ui/generator-progress-notification

Conversation

@korotkovao

@korotkovao korotkovao commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Summary

Implements improved generator progress notifications per internal issue 38263.

Key improvements:

  • Display project name in notification title: "Generating {projectName}"
  • Show progress updates through three distinct phases:
    • "Creating project files..."
    • "Installing dependencies..."
    • "Finalising..."
  • Include project name in success message: "Project {projectName} has been generated."
  • Use continuous indeterminate spinner (not stuck progress bar)
  • UK English spelling ("Finalising" not "Finalizing")

Technical details:

  • Added doGeneratorProgress method to track generator lifecycle events
  • Listens to yeoman generator events: method:writing, method:install, method:end
  • Changed doGeneratorDone return type from void to Thenable<any> to properly return the result of showDoneMessage
  • Added artificial 2s delay for writing phase to ensure UI visibility
  • Extracts project name from multiple generator state locations for compatibility
  • Stubbed WorkspaceFile.createWsWithPath and createWsWithUri in tests to prevent filesystem writes in CI

Test coverage:

  • Added 12 new comprehensive tests for doGeneratorProgress and project name display
  • Updated existing tests to handle async doGeneratorDone and stub WorkspaceFile methods
  • All 283 tests passing (265 in CI before fixes, now all passing)
  • Lint validation passing

- Add doGeneratorProgress method to YouiEvents interface to track
  generator lifecycle phases (writing, install, end)
- Implement progress notification in VSCodeYouiEvents with project
  name in title 'Generating {projectName}'
- Update progress messages through three phases: 'Creating project
  files...', 'Installing dependencies...', 'Finalising...'
- Add artificial delays to ensure UI visibility: 2s for writing
  phase, 1s for finalising phase
- Make doGeneratorDone async (returns Promise<void>) to properly
  handle 1s delay before closing notification
- Add event listeners in YeomanUI.onGenInstall for method:writing,
  method:install, and method:end events
- Extract project name from multiple generator state locations
  (state.project.name, options.projectName, etc.)
- Include project name in success message:
  'Project {projectName} has been generated.'
- Add void operators for all doGeneratorDone and doGeneratorProgress
  calls to satisfy lint requirements
- Use UK English spelling ('Finalising' not 'Finalizing')
- Show continuous indeterminate spinner (no progress bar increments)

Fixes #38263
- Add .js extensions to relative imports in vscode-youi-events.spec.ts
- Required for ESM module resolution (moduleResolution: node16)
- Fixes CI build errors: TS2835 relative import paths need explicit
  file extensions
- Add .js extension to @sap-devx/webview-rpc import path
- Required for ESM module resolution with external packages
- Remove console.log statements from onGenInstall method
- These were used during development for debugging
- Add test for doGeneratorInstall with project name parameter
- Add 5 new tests for doGeneratorDone with project name in messages
- Test all workspace scenarios: add to workspace, open in new workspace,
  save for future use
- Test different artifact types: project, module, files
- Verify project name appears correctly in success messages
- Improves coverage for getSuccessInfoMessage method
- Remove loggerWrapperMock declaration, setup, and verification
- Remove unused loggerWrapper import
- Fixes 'Cannot redefine property: getClassLogger' test error
- This mock was causing beforeEach to fail when run multiple times
- Add loggerWrapper.internalApi.setLogger(testLogger) in before() hook
- Add loggerWrapper.internalApi.resetLogger() in after() hook
- Restore loggerWrapper import
- Fixes 'Logger has not yet been initialized!' error in tests
- Change from 'import * as _ from "lodash"' to 'import lodash from "lodash"'
- Update all _.set() calls to lodash.set()
- Fixes 'TypeError: _.set is not a function' in tests
- Replace fsMock.expects() with sandbox.stub(fs) to avoid mock conflicts
- Remove incorrect module/files type tests (those don't use project names)
- Keep focused tests for three project scenarios with project name
- Fixes 'Cannot redefine property: existsSync' error
- Replace all 4 remaining fsMock.expects() calls with sandbox.stub(fs)
- Fixes 'Cannot redefine property: existsSync' in pre-existing tests
- Stubs can be replaced between tests, mocks cannot
- Use createRequire() to import fs as CJS for proper mocking with Sinon
- Move sandbox creation from before() to beforeEach() for proper cleanup
- Add sandbox.restore() in afterEach() to clean up mocks between tests
- Remove fs mock expectations that can't work due to ES module imports in WorkspaceFile
- Make doGeneratorDone properly await showDoneMessage to fix async timing
- Fixes 'Cannot redefine property: existsSync' and 'ES Modules cannot be stubbed' errors
- Coverage improved: vscode-youi-events.ts 79.06% → 94.41%, overall 88.93% → 91.56%
- Add test for showDoneMessage with skipResolve=false
- Add test for getSuccessInfoMessage with empty type
- Coverage improved: vscode-youi-events.ts 94.41% → 95.34%
- Overall coverage: 91.56% → 91.71% (0.29% short of 92% threshold)
Add fs.writeFileSync stubs to tests that create workspace files via WorkspaceFile.createWsWithPath.
This prevents filesystem errors in CI where ~/projects directory doesn't exist.
Fixes 3 failing tests in CI that were causing coverage to drop to 89.42%.
…rrors

Instead of stubbing fs.writeFileSync (which doesn't work for ESM imports),
stub WorkspaceFile.createWsWithPath and createWsWithUri directly.
This prevents filesystem writes in CI where /home/runner/projects/ doesn't exist.
@korotkovao
korotkovao force-pushed the feat/yeoman-ui/generator-progress-notification branch from 7981be9 to c5206df Compare July 30, 2026 11:30
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.

1 participant