test: migrate Pipelines Part 1 tests to @oclif/test v4 (PR 9/11) #3459
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR is part of a series migrating test files from @oclif/test v2 to v4 following the package upgrade in the foundation PR. This is PR 9 of 11 in the incremental migration plan.
Description
Migrates 7 test files in the Pipelines Part 1 category to be compatible with @oclif/test v4.1.15, including tests for pipeline CRUD operations (create, destroy, list, info, open, remove, rename).
Files Migrated (7 total)
test/unit/commands/pipelines/create.unit.test.ts(2 tests)test/unit/commands/pipelines/destroy.unit.test.ts(1 test)test/unit/commands/pipelines/index.unit.test.ts(2 tests)test/unit/commands/pipelines/info.unit.test.ts(6 tests)test/unit/commands/pipelines/open.unit.test.ts(1 test)test/unit/commands/pipelines/remove.unit.test.ts(1 test)test/unit/commands/pipelines/rename.unit.test.ts(1 test)Total: 14 tests migrated ✅
Migration Changes
All tests were updated to use the new @oclif/test v4 API:
Before (v2):
After (v4):
Key Pattern Changes
runCommand()function{stdout, stderr}from result instead ofctxparameterafterEach(() => nock.cleanAll())hooks for nock testsrunCommandHelperfor tests with sinon stubs (pipelines/open)Special Cases
Tests with Sinon Stubs
The
pipelines/opentest required the customrunCommandHelperinstead of @oclif/test v4'srunCommandbecause it uses sinon stubs forchildProcess.spawn:Helper Function Updates
The
pipelines/infotest file had helper functions that needed to be updated to work with the new pattern:Before (v2):
After (v4):
Whitespace Handling
Some tests in
pipelines/infousedremoveAllWhitespacehelper to handle spacing differences in table output across environments.Testing
✅ All 14 migrated tests pass locally
✅ No regressions in other test suites
✅ Build passes
Test Results:
Related