Skip to content

Commit f4871cc

Browse files
test: migrate sample tests from chai v3 to v4
1 parent 40b86d5 commit f4871cc

File tree

5 files changed

+79
-100
lines changed

5 files changed

+79
-100
lines changed

package-lock.json

+48-69
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/commands/generate.test.ts

+12-15
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,17 @@
44
** All rights reserved
55
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
66
*/
7-
import {expect, test} from '@oclif/test'
7+
import { runCommand } from '@oclif/test';
8+
import { expect } from 'chai';
89

9-
describe('generate', () => {
10-
test
11-
.stdout()
12-
.command(['generate'])
13-
.it('runs hello', ctx => {
14-
expect(ctx.stdout).to.contain('hello world')
15-
})
10+
describe( 'generate', () => {
11+
it( 'runs hello', async() => {
12+
const { stdout } = await runCommand< { name: string } >( [ 'generate' ] );
13+
expect( stdout ).to.contain( 'hello world' );
14+
} );
1615

17-
test
18-
.stdout()
19-
.command(['generate', '--name', 'jeff'])
20-
.it('runs hello --name jeff', ctx => {
21-
expect(ctx.stdout).to.contain('hello jeff')
22-
})
23-
})
16+
it( 'runs hello --name jeff', async() => {
17+
const { stdout } = await runCommand< { name: string } >( [ 'generate', '--name', 'jeff' ] );
18+
expect( stdout ).to.contain( 'hello jeff' );
19+
} );
20+
} );

0 commit comments

Comments
 (0)