Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cli/Cli.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import os from 'os';
import path from 'path';
import sinon from 'sinon';
import url from 'url';
import Command, { CommandError } from '../Command.js';
import Command, { CommandError, CommandErrorWithOutput } from '../Command.js';
import AnonymousCommand from '../m365/base/AnonymousCommand.js';
import cliCompletionUpdateCommand from '../m365/cli/commands/completion/completion-clink-update.js';
import { settingsNames } from '../settingsNames.js';
Expand Down Expand Up @@ -1275,14 +1275,14 @@ describe('Cli', () => {
});

it('correctly handles error when executing command with output', (done) => {
sinon.stub(mockCommand, 'commandAction').callsFake(() => { throw 'Error'; });
sinon.stub(mockCommand, 'commandAction').callsFake(() => { throw new CommandErrorWithOutput(new CommandError('Error')); });
Cli
.executeCommandWithOutput(mockCommand, { options: { _: [] } })
.then(_ => {
done('Command succeeded while expected fail');
}, e => {
try {
assert.strictEqual(e.error, 'Error');
assert.strictEqual(e.error.error.message, 'Error');
done();
}
catch (e) {
Expand Down
Loading