Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit 18214a3

Browse files
committed
Adding test and fixing lint errors
1 parent 5b01141 commit 18214a3

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

packages/command/src/command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import { Command as Base } from '@oclif/command'
44
export { flags } from '@oclif/command'
5-
import { CLIError as OCLIFError} from '@oclif/errors'
5+
import { CLIError as OCLIFError } from '@oclif/errors'
66
import { CLIError } from './clierror'
77
export { CLIError } from './clierror'
88
import ReadPipedData from './readpipeddata'

packages/command/test/command.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import {Command} from '../src/command'
22
import {CLIError} from './../src/clierror'
3+
import { CLIError as OCLIFError } from '@oclif/errors'
34
import {expect, fancy} from 'fancy-test'
45
import ReadPipedStdin from '../src/readpipeddata'
56
import * as path from 'path';
@@ -36,6 +37,20 @@ describe('command', () => {
3637
.do(output => expect(output.stderr).to.equal('failure\n'))
3738
.it('Exits with error')
3839

40+
fancy
41+
.stderr()
42+
.do(async () => {
43+
class Test extends Command {
44+
async run() {
45+
throw new OCLIFError('failure')
46+
}
47+
}
48+
49+
return Test.run([])
50+
})
51+
.do(output => expect(output.stderr).to.equal('failure\n'))
52+
.it('Handles OCLIF Errors')
53+
3954
fancy
4055
.stderr()
4156
.do(async () => {

0 commit comments

Comments
 (0)