mirror of
https://github.com/tiennm99/ccs.git
synced 2026-10-15 18:15:40 +00:00
refactor: remove deprecated native shell installers
- Remove installers/ directory (install.sh, install.ps1, uninstall.sh, uninstall.ps1) - Update CloudFlare worker to 301 redirect /install* to npm docs - Remove detectInstallationMethod() - npm is now only install method - Simplify update-command.ts to npm-only updates - Clean up tests to remove direct install references BREAKING CHANGE: Native shell installers (curl/irm) no longer work. Use `npm install -g @kaitranntt/ccs` instead.
This commit is contained in:
1 parent
be2b87ba98
commit
126cffc6dc
10 files changed
+51
-2385
No files matched your search
@@ -118,9 +118,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
describe('Beta stability warning display', function () {
|
||||
it('should show beta warning when installing from dev channel', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
// Mock update checker to return update available
|
||||
@@ -166,7 +164,6 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert(returnStable, 'should show return to stable instruction');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
updateCheckerModule.checkForUpdates = originalCheckForUpdates;
|
||||
require('child_process').spawn = originalSpawn;
|
||||
@@ -175,9 +172,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
|
||||
it('should NOT show beta warning for stable channel', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
// Mock update checker to return update available
|
||||
@@ -204,7 +199,6 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert(!unstableWarning, 'should not show production warning for stable channel');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
updateCheckerModule.checkForUpdates = originalCheckForUpdates;
|
||||
}
|
||||
@@ -212,9 +206,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
|
||||
it('should show beta warning even with force flag', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -228,7 +220,6 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert(betaWarning, 'should show beta warning even with force');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
@@ -237,9 +228,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
describe('handleCheckFailed with targetTag parameter', function () {
|
||||
it('should show manual update command with dev tag for npm install', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -265,9 +254,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
|
||||
it('should show manual update command with latest tag for stable', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -304,9 +291,7 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
consoleOutput = [];
|
||||
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => name;
|
||||
|
||||
try {
|
||||
@@ -330,96 +315,13 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert(manualCommand, `should show manual ${name} command with dev tag`);
|
||||
|
||||
// Restore functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
});
|
||||
});
|
||||
|
||||
it('should show direct install commands when npm detection fails', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'direct';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
// Mock checkForUpdates to return failed
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
updateCheckerModule.checkForUpdates = async () => ({
|
||||
status: 'check_failed',
|
||||
message: 'Failed to check for updates'
|
||||
});
|
||||
|
||||
// Call with beta: false (beta not supported for direct)
|
||||
updateCommandModule.handleUpdateCommand({ beta: false });
|
||||
} catch (e) {
|
||||
// Expected to exit
|
||||
}
|
||||
|
||||
// Should show direct install commands
|
||||
if (process.platform === 'win32') {
|
||||
const powershellCmd = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('irm ccs.kaitran.ca/install | iex')
|
||||
);
|
||||
assert(powershellCmd, 'should show PowerShell command for Windows');
|
||||
} else {
|
||||
const curlCmd = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('curl -fsSL ccs.kaitran.ca/install | bash')
|
||||
);
|
||||
assert(curlCmd, 'should show curl command for Unix');
|
||||
}
|
||||
});
|
||||
|
||||
it('should show beta not supported message for direct install with beta', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'direct';
|
||||
|
||||
try {
|
||||
// Mock checkForUpdates to return beta not supported
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
updateCheckerModule.checkForUpdates = async () => ({
|
||||
status: 'check_failed',
|
||||
reason: 'beta_not_supported',
|
||||
message: '--beta requires npm installation method'
|
||||
});
|
||||
|
||||
// Call with beta: true
|
||||
updateCommandModule.handleUpdateCommand({ beta: true });
|
||||
} catch (e) {
|
||||
// Expected to exit
|
||||
}
|
||||
|
||||
// Should show beta not supported message
|
||||
const betaError = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('[X] --beta requires npm installation')
|
||||
);
|
||||
assert(betaError, 'should show beta not supported error');
|
||||
|
||||
const currentMethod = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('Current installation method: direct installer')
|
||||
);
|
||||
assert(currentMethod, 'should show current installation method');
|
||||
|
||||
// Should show npm install instructions
|
||||
const npmInstall = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('npm install -g @kaitranntt/ccs')
|
||||
);
|
||||
assert(npmInstall, 'should show npm install instructions');
|
||||
|
||||
const ccsUpdateBeta = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('ccs update --beta')
|
||||
);
|
||||
assert(ccsUpdateBeta, 'should show ccs update --beta instruction');
|
||||
});
|
||||
});
|
||||
|
||||
describe('Error handling', function () {
|
||||
it('should handle checkForUpdates throwing error', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
|
||||
try {
|
||||
// Mock checkForUpdates to throw error
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
@@ -435,10 +337,6 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
});
|
||||
|
||||
it('should exit with error code 1 when check fails', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
|
||||
try {
|
||||
// Mock checkForUpdates to return failed
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
@@ -458,10 +356,6 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
|
||||
describe('Integration with update checker', function () {
|
||||
it('should pass correct targetTag to checkForUpdates', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
|
||||
// Track calls to checkForUpdates
|
||||
let checkForUpdatesCalls = [];
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
@@ -480,16 +374,11 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert.strictEqual(devCall.installMethod, 'npm');
|
||||
} finally {
|
||||
// Restore function
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
updateCheckerModule.checkForUpdates = originalCheckForUpdates;
|
||||
}
|
||||
});
|
||||
|
||||
it('should pass force parameter correctly', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
|
||||
// Track calls to checkForUpdates
|
||||
let checkForUpdatesCalls = [];
|
||||
const originalCheckForUpdates = updateCheckerModule.checkForUpdates;
|
||||
@@ -507,9 +396,8 @@ describe.skip('Update Command Beta Channel Implementation (Phase 3)', function (
|
||||
assert.strictEqual(checkForUpdatesCalls[0].force, true, 'should pass force parameter');
|
||||
} finally {
|
||||
// Restore function
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
updateCheckerModule.checkForUpdates = originalCheckForUpdates;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -6,7 +6,6 @@
|
||||
* - Skip update check when force is true
|
||||
* - Target tag calculation (latest vs dev) based on beta flag
|
||||
* - performNpmUpdate function with targetTag parameter
|
||||
* - handleDirectBetaNotSupported function for direct installs
|
||||
* - Success messages showing "Reinstall" vs "Update"
|
||||
*
|
||||
* NOTE: These tests are currently skipped because they require proper mocking
|
||||
@@ -113,9 +112,7 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
describe('Target tag calculation based on beta flag', function () {
|
||||
it('should set targetTag to "latest" when beta flag is false', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -130,16 +127,13 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(latestCall, 'should install latest tag when beta is false');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
|
||||
it('should set targetTag to "dev" when beta flag is true', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -154,7 +148,6 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(devCall, 'should install dev tag when beta is true');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
@@ -162,10 +155,6 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
|
||||
describe('Force flag behavior', function () {
|
||||
it('should show force reinstall message when force is true', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
|
||||
try {
|
||||
// Call with force: true
|
||||
updateCommandModule.handleUpdateCommand({ force: true, beta: false });
|
||||
@@ -176,16 +165,13 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
);
|
||||
assert(forceMessage, 'should show force reinstall message');
|
||||
} finally {
|
||||
// Restore original function
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
// No cleanup needed
|
||||
}
|
||||
});
|
||||
|
||||
it('should bypass update check when force is true', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -201,7 +187,6 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(npmCall.args.includes('install'), 'should call install command');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
@@ -210,9 +195,7 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
describe('Package manager tag syntax', function () {
|
||||
it('should use correct tag syntax for npm', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -226,16 +209,13 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(npmCall.args.includes('-g'), 'should use global flag for npm');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
|
||||
it('should use correct tag syntax for yarn', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'yarn';
|
||||
|
||||
try {
|
||||
@@ -249,16 +229,13 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(yarnCall.args.includes('global'), 'should use global flag for yarn');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
|
||||
it('should use correct tag syntax for pnpm', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'pnpm';
|
||||
|
||||
try {
|
||||
@@ -272,16 +249,13 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(pnpmCall.args.includes('-g'), 'should use global flag for pnpm');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
|
||||
it('should use correct tag syntax for bun', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'bun';
|
||||
|
||||
try {
|
||||
@@ -295,80 +269,15 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(bunCall.args.includes('-g'), 'should use global flag for bun');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('Direct install beta not supported', function () {
|
||||
it('should show error for direct install with --beta', function () {
|
||||
// Mock installation method detection as direct
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'direct';
|
||||
|
||||
try {
|
||||
// Call with force: true, beta: true
|
||||
updateCommandModule.handleUpdateCommand({ force: true, beta: true });
|
||||
|
||||
// Should show beta not supported error
|
||||
const betaError = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('--beta flag requires npm installation')
|
||||
);
|
||||
assert(betaError, 'should show beta not supported error');
|
||||
|
||||
const directInstallMsg = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('Current installation method: direct installer')
|
||||
);
|
||||
assert(directInstallMsg, 'should show direct installer message');
|
||||
|
||||
// Should exit with error code
|
||||
assert(processExitCalls.length > 0, 'should call process.exit');
|
||||
assert(processExitCalls[0] === 1, 'should exit with error code 1');
|
||||
} finally {
|
||||
// Restore original function
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
}
|
||||
});
|
||||
|
||||
it('should allow force reinstall with direct install when beta is false', function () {
|
||||
// Mock installation method detection as direct
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'direct';
|
||||
|
||||
try {
|
||||
// Call with force: true, beta: false
|
||||
updateCommandModule.handleUpdateCommand({ force: true, beta: false });
|
||||
|
||||
// Should NOT show beta error
|
||||
const betaError = consoleOutput.find(output =>
|
||||
output[0] && output[0].includes('--beta flag requires npm installation')
|
||||
);
|
||||
assert(!betaError, 'should not show beta error when beta is false');
|
||||
|
||||
// Should call spawn for direct update
|
||||
assert(spawnCalls.length > 0, 'should call spawn for direct update');
|
||||
|
||||
// Should call curl or powershell
|
||||
const directUpdateCall = spawnCalls[0];
|
||||
if (process.platform === 'win32') {
|
||||
assert(directUpdateCall.command === 'powershell.exe', 'should call powershell on Windows');
|
||||
} else {
|
||||
assert(directUpdateCall.command === '/bin/bash', 'should call bash on Unix');
|
||||
}
|
||||
} finally {
|
||||
// Restore original function
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
describe('Success messages', function () {
|
||||
it('should show "Reinstalling" message when force is true', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -382,7 +291,6 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(reinstallingMsg, 'should show reinstalling message');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
@@ -391,9 +299,7 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
describe('Combined force and beta behavior', function () {
|
||||
it('should handle force with beta for npm install', function () {
|
||||
// Mock package manager detection
|
||||
const originalDetectInstallationMethod = packageManagerDetectorModule.detectInstallationMethod;
|
||||
const originalDetectPackageManager = packageManagerDetectorModule.detectPackageManager;
|
||||
packageManagerDetectorModule.detectInstallationMethod = () => 'npm';
|
||||
packageManagerDetectorModule.detectPackageManager = () => 'npm';
|
||||
|
||||
try {
|
||||
@@ -412,9 +318,8 @@ describe.skip('Update Command - Force Reinstall Implementation (Phase 2)', funct
|
||||
assert(forceMessage, 'should show force reinstall from dev channel message');
|
||||
} finally {
|
||||
// Restore original functions
|
||||
packageManagerDetectorModule.detectInstallationMethod = originalDetectInstallationMethod;
|
||||
packageManagerDetectorModule.detectPackageManager = originalDetectPackageManager;
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user