Skip to content
Merged
5 changes: 2 additions & 3 deletions extensions/ql-vscode/src/packaging.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import {
getOnDiskWorkspaceFolders,
showAndLogErrorMessage,
showAndLogInformationMessage,
showAndLogWarningMessage,
} from './helpers';
import { QuickPickItem, window } from 'vscode';
import { ProgressCallback, UserCancellationException } from './commandRunner';
Expand Down Expand Up @@ -123,8 +122,8 @@ export async function handleInstallPacks(
}
if (failedPacks.length > 0) {
void logger.log(`Errors:\n${errors.join('\n')}`);
void showAndLogWarningMessage(
`Unable to install some packs: ${failedPacks.join(', ')}. See logs for more details.`
throw new Error(
`Unable to install packs: ${failedPacks.join(', ')}. See logs for more details.`
Comment thread
shati-patel marked this conversation as resolved.
Outdated
);
Comment thread
shati-patel marked this conversation as resolved.
} else {
void showAndLogInformationMessage('Finished installing packs.');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('Packaging commands', function() {
showAndLogErrorMessageSpy = sandbox.stub();
showAndLogInformationMessageSpy = sandbox.stub();
mod = proxyquire('../../packaging', {
'../helpers': {
'./helpers': {
showAndLogErrorMessage: showAndLogErrorMessageSpy,
showAndLogInformationMessage: showAndLogInformationMessageSpy,
},
Expand Down Expand Up @@ -88,21 +88,22 @@ describe('Packaging commands', function() {
);
});

it('should install selected workspace packs', async () => {
it('should attempt to install selected workspace packs', async () => {
const rootDir = path.join(__dirname, '../../../src/vscode-tests/cli-integration/data');
quickPickSpy.resolves(
[
{
label: 'integration-test-queries-javascript',
packRootDir: [rootDir],
},
]
);

await mod.handleInstallPacks(cli, progress);
quickPickSpy.resolves([
{
label: 'integration-test-queries-javascript',
packRootDir: [rootDir],
},
]);

expect(showAndLogInformationMessageSpy.firstCall.args[0]).to.contain(
'Finished installing packs.'
);
try {
await mod.handleInstallPacks(cli, progress);
expect(showAndLogInformationMessageSpy.firstCall.args[0]).to.contain(
'Finished installing packs.'
);
} catch (error) {
expect(error.message).to.contain('Unable to install packs:');
}
Comment thread
shati-patel marked this conversation as resolved.
Outdated
});
});