Skip to content
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 bin/bats-test-runner.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env node

const os = require('os')
const {spawn} = require('child_process')
import os from 'os'
import { spawn } from 'child_process'

if (os.platform() === 'win32' || os.platform() === 'windows') console.log('skipping on windows')
else spawn('yarn bats test/acceptance/*.bats', {stdio: 'inherit', shell: true})
else spawn('npx bats test/acceptance/*.bats', {stdio: 'inherit', shell: true})
1 change: 1 addition & 0 deletions cspell-dictionary.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ aname
APAC
apikey
appname
applink
apresharedkey
armel
armhf
Expand Down
14 changes: 4 additions & 10 deletions test/acceptance/commands-output.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export default `Command Summary
export default ` Id Summary
────────────────────────────────────────────── ──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
2fa check 2fa status
2fa:disable disables 2fa on account
Expand Down Expand Up @@ -87,14 +87,13 @@ clients:destroy delete client by ID
clients:info show details of an oauth client
clients:rotate rotate OAuth client secret
clients:update update OAuth client
commands list all the commands
commands list all heroku commands.
config display the config vars for an app
config:edit interactively edit config vars
config:get display a single config value for an app
config:remove unset one or more config vars
config:set set one or more config vars
config:unset unset one or more config vars
container Use containers to build and deploy Heroku apps
container:login log in to Heroku Container Registry
container:logout log out from Heroku Container Registry
container:pull pulls an image from an app's process type
Expand Down Expand Up @@ -224,9 +223,9 @@ pipelines:setup bootstrap a new pipeline with com
pipelines:transfer transfer ownership of a pipeline
pipelines:update update the app's stage in a pipeline
plugins List installed plugins.
plugins:add Installs a plugin into the CLI.
plugins:add Installs a plugin into heroku.
plugins:inspect Displays installation properties of a plugin.
plugins:install Installs a plugin into the CLI.
plugins:install Installs a plugin into heroku.
plugins:link Links a plugin into the CLI for development.
plugins:remove Removes a plugin from the CLI.
plugins:uninstall Removes a plugin from the CLI.
Expand All @@ -235,14 +234,10 @@ plugins:update Update installed plugins.
ps list dynos for an app
ps:autoscale:disable disable web dyno autoscaling
ps:autoscale:enable enable web dyno autoscaling
ps:copy Copy a file from a dyno to the local filesystem
ps:exec Create an SSH session to a dyno
ps:forward Forward traffic on a local port to a dyno
ps:kill stop an app dyno or process type
ps:resize manage dyno sizes
ps:restart restart an app dyno or process type
ps:scale scale dyno quantity up or down
ps:socks Launch a SOCKS proxy into a dyno
ps:stop stop an app dyno or process type
ps:type manage dyno sizes
ps:wait wait for all dynos to be running latest version after a release
Expand All @@ -252,7 +247,6 @@ redis:cli opens a redis prompt
redis:credentials display credentials information
redis:info gets information about redis
redis:keyspace-notifications set the keyspace notifications configuration
redis:maintenance manage maintenance windows
redis:maxmemory set the key eviction policy when instances reach their storage limit
redis:promote sets DATABASE as your REDIS_URL
redis:stats-reset reset all stats covered by RESETSTAT (https://redis.io/commands/config-resetstat)
Expand Down
66 changes: 57 additions & 9 deletions test/acceptance/plugin.acceptance.test.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,74 @@
import execa from 'execa'
import * as fs from 'fs-extra'
import fs from 'fs-extra'
import {fileURLToPath} from 'node:url'
import * as path from 'path'

const plugins = ['heroku-ps-exec']
const __filename = fileURLToPath(import.meta.url)
const __dirname = path.dirname(__filename)
const plugins = ['@heroku-cli/plugin-applink']

const skipOnWindows = process.platform === 'win32' ? it.skip : it

describe.skip('plugins', function () {
function resolvePluginPath(plugin: string): null | string {
const candidates = [
path.resolve(__dirname, '../../node_modules', plugin, 'package.json'),
path.resolve(__dirname, '../../../node_modules', plugin, 'package.json'),
]

for (const p of candidates) {
if (fs.existsSync(p)) return path.dirname(p)
}

return null
}

function safeCloneDirName(plugin: string): string {
return plugin.replace('@heroku-cli/', '')
}

describe('plugins', function () {
plugins.forEach(plugin => {
const pluginRoot = resolvePluginPath(plugin)
if (!pluginRoot) {
it.skip(plugin, async function () {})
return
}

skipOnWindows(plugin, async () => {
const cwd = path.join(__dirname, '../../tmp/plugin', plugin)
const cwd = path.resolve(__dirname, '../../tmp/plugin', safeCloneDirName(plugin))
await fs.remove(cwd)
const pkg = await fs.readJSON(path.join(__dirname, '../../node_modules', plugin, 'package.json'))
if (!pkg.repository) {
const pkg = await fs.readJSON(path.join(pluginRoot, 'package.json'))
const repo = pkg.repository

if (!repo) {
throw new Error('No repository found')
}

await execa('git', ['clone', pkg.repository.url.split('+')[1], cwd])
const repoUrl = typeof repo === 'string' ? repo : repo.url

if (!repoUrl) {
throw new Error('No repository URL found in package.json')
}

let cloneUrl: string

if (repoUrl.includes('+')) {
cloneUrl = repoUrl.split('+')[1]
} else if (repoUrl.startsWith('github:')) {
cloneUrl = `https://github.com/${repoUrl.slice(7)}.git`
} else if (repoUrl.startsWith('http://') || repoUrl.startsWith('https://')) {
cloneUrl = repoUrl
} else if (/^[^/]+\/[^/]+$/.test(repoUrl)) {
cloneUrl = `https://github.com/${repoUrl}.git`
} else {
cloneUrl = repoUrl
}

await execa('git', ['clone', cloneUrl, cwd])
const opts = {cwd, stdio: [0, 1, 2]}
await execa('git', ['checkout', `v${pkg.version}`], opts)
await execa('yarn', [], opts)
await execa('yarn', ['test'], opts)
await execa('npm', [], opts)
await execa('npm', ['test'], opts)
})
})
})
Loading
Loading