Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use oclif/test v4 #719

Merged
merged 2 commits into from
May 22, 2024
Merged
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
"@oclif/core": "^3.26.6"
},
"devDependencies": {
"@commitlint/config-conventional": "^18",
"@commitlint/config-conventional": "^19",
"@oclif/prettier-config": "^0.2.1",
"@oclif/test": "^3.2.15",
"@oclif/test": "^4",
"@types/chai": "^4.3.11",
"@types/mocha": "^10.0.6",
"@types/node": "^18",
"chai": "^4.4.1",
"commitlint": "^18",
"commitlint": "^19",
"eslint": "^8.57.0",
"eslint-config-oclif": "^5.2.0",
"eslint-config-oclif-typescript": "^3.1.7",
Expand Down
23 changes: 10 additions & 13 deletions test/commands/help.test.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import {expect, test} from '@oclif/test'
import {runCommand} from '@oclif/test'
import {expect} from 'chai'
import {readFileSync} from 'node:fs'

const {version: VERSION} = JSON.parse(readFileSync('package.json', 'utf8'))
const UA = `@oclif/plugin-help/${VERSION} ${process.platform}-${process.arch} node-${process.version}`

describe('help command', () => {
test
.stdout()
.command(['help', 'help'])
.it('shows help command help', (ctx) => {
expect(ctx.stdout).to.equal(`Standard help for oclif.
it('shows help command help', async () => {
const {stdout} = await runCommand('help help')
expect(stdout).to.equal(`Standard help for oclif.

VERSION
${UA}
Expand All @@ -21,13 +20,11 @@ COMMANDS
help Display help for oclif.

`)
})
})

test
.stdout()
.command(['help'])
.it('shows root help', (ctx) => {
expect(ctx.stdout).to.equal(`Standard help for oclif.
it('shows root help', async () => {
const {stdout} = await runCommand('help')
expect(stdout).to.equal(`Standard help for oclif.

VERSION
${UA}
Expand All @@ -39,5 +36,5 @@ COMMANDS
help Display help for oclif.

`)
})
})
})
Loading
Loading