Skip to content

Commit

Permalink
chore: bump @oclif/test (#543)
Browse files Browse the repository at this point in the history
* chore: bump @oclif/test

* chore: add back --forbid-only
  • Loading branch information
mdonnalley committed Oct 31, 2022
1 parent 30826b3 commit 5db7ff3
Show file tree
Hide file tree
Showing 6 changed files with 77 additions and 67 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -38,7 +38,7 @@
"@commitlint/config-conventional": "^12.1.4",
"@oclif/plugin-help": "^5.1.11",
"@oclif/plugin-plugins": "^2.1.0",
"@oclif/test": "^2.1.0",
"@oclif/test": "^2.2.8",
"@types/ansi-styles": "^3.2.1",
"@types/chai": "^4.3.0",
"@types/chai-as-promised": "^7.1.5",
Expand Down Expand Up @@ -114,4 +114,4 @@
"pretest": "yarn build --noEmit && tsc -p test --noEmit --skipLibCheck"
},
"types": "lib/index.d.ts"
}
}
10 changes: 10 additions & 0 deletions test/help/help-test-utils.ts
Expand Up @@ -80,3 +80,13 @@ export const topicHelp = (topic: Interfaces.Topic) => ({
ctx.expectation = 'has topicHelp'
},
})

export function monkeyPatchCommands(config: any, plugins: Array<{commands: Interfaces.Command[], topics: Interfaces.Topic[]}>) {
config.plugins = plugins
config._commands = new Map()
config._topics = new Map()
for (const plugin of config.plugins) {
config.loadCommands(plugin)
config.loadTopics(plugin)
}
}
25 changes: 13 additions & 12 deletions test/help/show-customized-help.test.ts
Expand Up @@ -5,6 +5,7 @@ import * as path from 'path'
import {CommandHelp, Help} from '../../src/help'
import {AppsIndexWithDesc, AppsDestroy, AppsCreate, AppsTopic, AppsAdminTopic, AppsAdminAdd} from './fixtures/fixtures'
import {Interfaces, Config} from '../../src'
import {monkeyPatchCommands} from './help-test-utils'

const g: any = global
g.oclif.columns = 80
Expand Down Expand Up @@ -85,12 +86,12 @@ describe('showHelp for root', () => {
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsIndexWithDesc, AppsCreate, AppsDestroy],
topics: [],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp([])
Expand All @@ -116,12 +117,12 @@ COMMANDS
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsIndexWithDesc],
topics: [],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp([])
Expand All @@ -146,12 +147,12 @@ describe('showHelp for a command', () => {
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsCreate],
topics: [AppsTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps:create'])
Expand All @@ -175,12 +176,12 @@ CUSTOM
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsIndexWithDesc, AppsCreate, AppsAdminAdd],
topics: [AppsTopic, AppsAdminTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand Down
49 changes: 24 additions & 25 deletions test/help/show-help.test.ts
@@ -1,10 +1,12 @@
import {expect, test as base} from '@oclif/test'
import {test as base} from '@oclif/test'
import {stub, SinonStub} from 'sinon'
import * as path from 'path'

import {Help} from '../../src/help'
import {AppsIndex, AppsDestroy, AppsCreate, AppsTopic, AppsAdminTopic, AppsAdminAdd, AppsAdminIndex, DbCreate, DbTopic} from './fixtures/fixtures'
import {Interfaces, Config} from '../../src'
import {monkeyPatchCommands} from './help-test-utils'
import {expect} from 'chai'

const g: any = global
g.oclif.columns = 80
Expand Down Expand Up @@ -95,12 +97,12 @@ COMMANDS
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsIndex],
topics: [],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp([])
Expand All @@ -124,12 +126,12 @@ describe('showHelp for a topic', () => {
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsCreate, AppsDestroy],
topics: [AppsTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand All @@ -149,12 +151,12 @@ COMMANDS
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsCreate, AppsDestroy, AppsAdminAdd],
topics: [AppsTopic, AppsAdminTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand All @@ -177,12 +179,12 @@ COMMANDS
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;
const config = ctx.config

(config as any).plugins = [{
monkeyPatchCommands(config, [{
commands: [AppsCreate, AppsDestroy, AppsAdminIndex, AppsAdminAdd],
topics: [AppsTopic, AppsAdminTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand All @@ -206,12 +208,11 @@ COMMANDS
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;

(config as any).plugins = [{
const config = ctx.config
monkeyPatchCommands(config, [{
commands: [AppsCreate, AppsDestroy, AppsAdminAdd, DbCreate],
topics: [AppsTopic, AppsAdminTopic, DbTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand All @@ -236,12 +237,11 @@ describe('showHelp for a command', () => {
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;

(config as any).plugins = [{
const config = ctx.config
monkeyPatchCommands(config, [{
commands: [AppsCreate],
topics: [AppsTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps:create'])
Expand All @@ -262,12 +262,11 @@ DESCRIPTION
.loadConfig()
.stdout()
.do(async ctx => {
const config = ctx.config;

(config as any).plugins = [{
const config = ctx.config
monkeyPatchCommands(config, [{
commands: [AppsIndex, AppsCreate, AppsAdminAdd],
topics: [AppsTopic, AppsAdminTopic],
}]
}])

const help = new TestHelp(config as any)
await help.showHelp(['apps'])
Expand Down
3 changes: 2 additions & 1 deletion test/help/util.test.ts
@@ -1,8 +1,9 @@
import {resolve} from 'path'
import {Config, Interfaces} from '../../src'
import {expect, test} from '@oclif/test'
import {test} from '@oclif/test'
import {loadHelpClass, standardizeIDFromArgv} from '../../src/help'
import configuredHelpClass from '../../src/help/_test-help-class'
import {expect} from 'chai'

describe('util', () => {
let config: Interfaces.Config
Expand Down
53 changes: 26 additions & 27 deletions yarn.lock
Expand Up @@ -440,33 +440,32 @@
supports-color "^8.1.1"
tslib "^2"

"@oclif/core@^1.2.0", "@oclif/core@^1.3.1":
version "1.3.4"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.3.4.tgz#80c8c24f2f5fc82b913703b7226200cdd941416d"
integrity sha512-IqwfP1qHJ7V6LXxyCBBX12T0vNvrcK9Mlxv0xyt+snhslwThBXJY09umWcQJhWe+vxA8Y/mihB1bUkfURd2P2A==
"@oclif/core@^1.2.0", "@oclif/core@^1.20.0":
version "1.20.0"
resolved "https://registry.yarnpkg.com/@oclif/core/-/core-1.20.0.tgz#04a37b66cedeeb21630b91095466641bc499f706"
integrity sha512-yByf6w5JOFsbIeyYEF8rSbvN4uCI/7O9lGNg0kY0N+HH6edtpCtGHe6p/4+5yPNEmGL6P8IEKi+9s0Ys774mgw==
dependencies:
"@oclif/linewrap" "^1.0.0"
"@oclif/screen" "^3.0.2"
ansi-escapes "^4.3.0"
ansi-styles "^4.2.0"
ansi-escapes "^4.3.2"
ansi-styles "^4.3.0"
cardinal "^2.1.1"
chalk "^4.1.2"
clean-stack "^3.0.1"
cli-progress "^3.10.0"
debug "^4.3.3"
debug "^4.3.4"
ejs "^3.1.6"
fs-extra "^9.1.0"
get-package-type "^0.1.0"
globby "^11.0.4"
globby "^11.1.0"
hyperlinker "^1.0.0"
indent-string "^4.0.0"
is-wsl "^2.2.0"
js-yaml "^3.13.1"
lodash "^4.17.21"
js-yaml "^3.14.1"
natural-orderby "^2.0.3"
object-treeify "^1.1.4"
object-treeify "^1.1.33"
password-prompt "^1.1.2"
semver "^7.3.5"
semver "^7.3.7"
string-width "^4.2.3"
strip-ansi "^6.0.1"
supports-color "^8.1.1"
Expand Down Expand Up @@ -509,13 +508,13 @@
resolved "https://registry.yarnpkg.com/@oclif/screen/-/screen-3.0.2.tgz#969054308fe98d130c02844a45cc792199b75670"
integrity sha512-S/SF/XYJeevwIgHFmVDAFRUvM3m+OjhvCAYMk78ZJQCYCQ5wS7j+LTt1ZEv2jpEEGg2tx/F6TYYWxddNAYHrFQ==

"@oclif/test@^2.1.0":
version "2.1.0"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.1.0.tgz#e5a0ba619c890770782e48c82d18f5921e2d2b9f"
integrity sha512-o+JTv3k28aMUxywJUlJY1/DORLqumoZFRII492phOmtXM16rD6Luy3z1qinT4BvEtPj2BzOPd2whr/VdYszaYw==
"@oclif/test@^2.2.8":
version "2.2.8"
resolved "https://registry.yarnpkg.com/@oclif/test/-/test-2.2.8.tgz#c4114922428f90f94e3775b596876a88830a91c2"
integrity sha512-VPVR1XLiTYqKToXlU7TPRnp5WMZvzfjyyPDH2sqKVCuEj9ZdEsK8m4woTK1n9aX1HI1Yv0tyyvg2a8HbUJOwhw==
dependencies:
"@oclif/core" "^1.3.1"
fancy-test "^2.0.0"
"@oclif/core" "^1.20.0"
fancy-test "^2.0.5"

"@sinonjs/commons@^1.6.0", "@sinonjs/commons@^1.7.0", "@sinonjs/commons@^1.8.3":
version "1.8.3"
Expand Down Expand Up @@ -891,7 +890,7 @@ ansi-escapes@^3.1.0:
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-3.2.0.tgz#8780b98ff9dbf5638152d1f1fe5c1d7b4442976b"
integrity sha512-cBhpre4ma+U0T1oM5fXg7Dy1Jw7zzwv7lt/GoCpr+hDQJoYnKVPLL4dCvSEFMmQurOQvSrwT7SL/DAlhBI97RQ==

ansi-escapes@^4.2.1, ansi-escapes@^4.3.0, ansi-escapes@^4.3.2:
ansi-escapes@^4.2.1, ansi-escapes@^4.3.2:
version "4.3.2"
resolved "https://registry.yarnpkg.com/ansi-escapes/-/ansi-escapes-4.3.2.tgz#6b2291d1db7d98b6521d5f1efa42d0f3a9feb65e"
integrity sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==
Expand Down Expand Up @@ -920,7 +919,7 @@ ansi-styles@^3.2.1:
dependencies:
color-convert "^1.9.0"

ansi-styles@^4.0.0, ansi-styles@^4.1.0, ansi-styles@^4.2.0, ansi-styles@^4.2.1, ansi-styles@^4.3.0:
ansi-styles@^4.0.0, ansi-styles@^4.1.0, ansi-styles@^4.2.1, ansi-styles@^4.3.0:
version "4.3.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-4.3.0.tgz#edd803628ae71c04c85ae7a0906edad34b648937"
integrity sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==
Expand Down Expand Up @@ -1316,7 +1315,7 @@ debug@4.3.1:
dependencies:
ms "2.1.2"

debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.3, debug@^4.3.4:
debug@^4.0.1, debug@^4.1.0, debug@^4.1.1, debug@^4.3.1, debug@^4.3.4:
version "4.3.4"
resolved "https://registry.yarnpkg.com/debug/-/debug-4.3.4.tgz#1319f6579357f2338d3337d2cdd4914bb5dcc865"
integrity sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==
Expand Down Expand Up @@ -1695,10 +1694,10 @@ fancy-test@^1.4.10:
nock "^13.0.0"
stdout-stderr "^0.1.9"

fancy-test@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-2.0.0.tgz#f1477ae4190820318816914aabe273c0a0dbd597"
integrity sha512-SFb2D/VX9SV+wNYXO1IIh1wyxUC1GS0mYCFJOWD1ia7MPj9yE2G8jaPkw4t/pg0Sj7/YJP56OzMY4nAuJSOugQ==
fancy-test@^2.0.5:
version "2.0.6"
resolved "https://registry.yarnpkg.com/fancy-test/-/fancy-test-2.0.6.tgz#e8ac4e652214dd0424a44e8e8a684d70897cdef4"
integrity sha512-vzH5MOYK+vAQW/jnRnBiyASemIOAmSYuh2j12w4Ktzh+u2d69OENvI9GLDvNLMxOIqCtwz8ndLMH+5cJHfBmSQ==
dependencies:
"@types/chai" "*"
"@types/lodash" "*"
Expand Down Expand Up @@ -1916,7 +1915,7 @@ globals@^13.6.0, globals@^13.9.0:
dependencies:
type-fest "^0.20.2"

globby@^11.0.1, globby@^11.0.3, globby@^11.0.4, globby@^11.1.0:
globby@^11.0.1, globby@^11.0.3, globby@^11.1.0:
version "11.1.0"
resolved "https://registry.yarnpkg.com/globby/-/globby-11.1.0.tgz#bd4be98bb042f83d796f7e3811991fbe82a0d34b"
integrity sha512-jhIXaOzy1sb8IyocaruWSn1TjmnBVs8Ayhcy83rmxNJ8q2uWKCAj3CnJY+KpGSXCueAPc0i05kVvVKtP1t9S3g==
Expand Down Expand Up @@ -2603,7 +2602,7 @@ npm-run-path@^4.0.1:
dependencies:
path-key "^3.0.0"

object-treeify@^1.1.33, object-treeify@^1.1.4:
object-treeify@^1.1.33:
version "1.1.33"
resolved "https://registry.yarnpkg.com/object-treeify/-/object-treeify-1.1.33.tgz#f06fece986830a3cba78ddd32d4c11d1f76cdf40"
integrity sha512-EFVjAYfzWqWsBMRHPMAXLCDIJnpMhdWAqR7xG6M6a2cs6PMFpl/+Z20w9zDW4vkxOFfddegBKq9Rehd0bxWE7A==
Expand Down

0 comments on commit 5db7ff3

Please sign in to comment.