Skip to content

Commit

Permalink
test: use oclif/test v4 (#719)
Browse files Browse the repository at this point in the history
* test: use oclif/test v4

* chore: update dev deps
  • Loading branch information
mdonnalley authored May 22, 2024
1 parent fcb403f commit bab49bc
Show file tree
Hide file tree
Showing 3 changed files with 253 additions and 590 deletions.
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

0 comments on commit bab49bc

Please sign in to comment.