test: migrate remaining tests to @oclif/test v4 (PR #11) #3461
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 completes the final batch of remaining test files.
Summary
Migrates 16 test files covering spaces, ps, reviewapps, utilities, webhooks, and integration tests to be compatible with @oclif/test v4.1.15. This PR handles a diverse set of test scenarios including command tests, utility function tests, library tests, and integration tests.
Files Migrated (16 total)
Commands - ps (3 files):
Commands - reviewapps (2 files):
Commands - spaces (8 files):
Library & Utils (3 files):
Integration (1 file):
Total: 68 tests migrated ✅
Migration Changes
Before (v2) - Command tests:
After (v4) - Command tests:
Before (v2) - Tests with stubs:
After (v4) - Tests with stubs:
Before (v2) - Utility/library tests:
After (v4) - Utility/library tests:
Key Pattern Changes
runCommand()for all command tests{stdout, stderr, error}from runCommand results{error}destructuring for error assertions instead of try/catch or .catch() chainsexpectimport from'@oclif/test'to'chai'sinon.stub()and propersinon.restore()in afterEachafterEach(() => nock.cleanAll())hooks for proper test isolationdynoTestSetup()in ps/enable to reduce test duplicationTesting
Notes
This PR completes the final batch of remaining test files for the @oclif/test v4 migration. The files covered a diverse range of testing scenarios:
Key learnings:
hux.waitfrom@heroku/heroku-cli-utilinstead ofux.waitRelated