Skip to content

Commit

Permalink
Change some mocha errors to warns, autofix using arrow functions, fix…
Browse files Browse the repository at this point in the history
… misc linting errors
  • Loading branch information
eablack committed Apr 29, 2024
1 parent 6dbe1c2 commit 5b1d92f
Show file tree
Hide file tree
Showing 251 changed files with 1,454 additions and 1,292 deletions.
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
"import/no-unresolved": "error",
"indent": ["error", 2, {"MemberExpression": 1}],
"func-names":"warn", // TODO: fix issues and turn this back on
"mocha/no-mocha-arrows": "warn",
"mocha/no-exports": "warn",
"mocha/no-setup-in-describe": "warn",
"no-await-in-loop": "off", // Perfect legit to use await in loops, we should leave it off
"no-constant-condition": ["error", {"checkLoops": false }],
"no-else-return": "warn", // TODO: fix issues and turn this back on
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/acceptance/plugin.acceptance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const plugins = ['heroku-ps-exec']

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

describe.skip('plugins', () => {
describe.skip('plugins', function () {
plugins.forEach(plugin => {
skipOnWindows(plugin, async () => {
const cwd = path.join(__dirname, '../../tmp/plugin', plugin)
Expand Down
68 changes: 34 additions & 34 deletions packages/cli/test/acceptance/smoke.acceptance.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,167 +26,167 @@ function run(args = '') {
return qq.x([bin, args].join(' '), {stdio: undefined})
}

describe('@acceptance smoke tests', () => {
describe('commands', () => {
it('heroku access', async () => {
describe('@acceptance smoke tests', function () {
describe('commands', function () {
it('heroku access', async function () {
const {stdout} = await run(`access ${appFlag}`)
expect(stdout).to.contain('heroku-cli@salesforce.com')
})

it('heroku addons', async () => {
it('heroku addons', async function () {
const {stdout} = await run(`addons ${appFlag}`)
expect(stdout).to.contain('No add-ons for app heroku-cli-ci-smoke-test-app.')
})

it('heroku apps', async () => {
it('heroku apps', async function () {
const cmd = await run('apps')
expect(cmd.stdout).to.contain('You have no apps.')
})

it('heroku apps:info', async () => {
it('heroku apps:info', async function () {
const {stdout} = await run(`info ${appFlag}`)
expect(stdout).to.contain(app)
})

it('heroku auth:whoami', async () => {
it('heroku auth:whoami', async function () {
const {stdout} = await run('auth:whoami')
expect(stdout).to.contain('heroku-cli@salesforce.com')
})

it('heroku authorizations', async () => {
it('heroku authorizations', async function () {
const {stdout} = await run('authorizations')
expect(stdout).to.contain('global')
})

it('heroku autocomplete', async () => {
it('heroku autocomplete', async function () {
const {stdout} = await run('autocomplete bash')
expect(stdout).to.contain('Setup Instructions for HEROKU CLI Autocomplete')
})

it('heroku buildpacks:search', async () => {
it('heroku buildpacks:search', async function () {
const {stdout} = await run('buildpacks:search ruby')
expect(stdout).to.contain('Buildpack')
expect(stdout).to.contain('Category')
expect(stdout).to.contain('Description')
})

it('heroku certs', async () => {
it('heroku certs', async function () {
const {stdout} = await run(`certs ${appFlag}`)
expect(stdout).to.contain('has no SSL certificates')
})

it('heroku ci', async () => {
it('heroku ci', async function () {
const {stdout} = await run(`ci ${appFlag}`)
expect(stdout).to.contain('Showing latest test runs for the smoke-test-app-ci pipeline')
})

it('heroku ci:config', async () => {
it('heroku ci:config', async function () {
const {stdout} = await run(`ci:config ${appFlag}`)
expect(stdout).to.contain('smoke-test-app-ci test config vars')
})

it('heroku clients', async () => {
it('heroku clients', async function () {
const {stdout} = await run('clients')
expect(stdout).to.contain('No OAuth clients.')
})

it('heroku config', async () => {
it('heroku config', async function () {
const {stdout} = await run(`config ${appFlag}`)
expect(stdout).to.contain('heroku-cli-ci-smoke-test-app Config Vars')
})

it('heroku container:login', async () => {
it('heroku container:login', async function () {
const {stdout} = await run('container:login')
expect(stdout).to.contain('Login Succeeded')
})

it('heroku domains', async () => {
it('heroku domains', async function () {
const {stdout} = await run(`domains ${appFlag}`)
expect(stdout).to.contain('heroku-cli-ci-smoke-test-app Heroku Domain')
})

it('heroku git:clone', async () => {
it('heroku git:clone', async function () {
fs.mkdirSync('temp')
const {stderr} = await run(`git:clone temp ${appFlag}`)
expect(stderr).to.contain("Cloning into 'temp'")
fs.removeSync('temp')
})

it('heroku help', async () => {
it('heroku help', async function () {
const {stdout} = await run('help')
expect(stdout).to.contain('$ heroku [COMMAND]')
})

it('heroku local:version', async () => {
it('heroku local:version', async function () {
const {stdout} = await run('local:version')
expect(stdout).to.contain('3.0.1')
})

it('heroku pipelines', async () => {
it('heroku pipelines', async function () {
const {stdout} = await run('pipelines')
expect(stdout).to.match(/===.*My Pipelines/)
})

it('heroku pg:backups', async () => {
it('heroku pg:backups', async function () {
const {stdout} = await run(`pg:backups ${appFlag}`)
expect(stdout).to.match(/===.*Backups/)
expect(stdout).to.match(/===.*Restores/)
expect(stdout).to.match(/===.*Copies/)
})

it('heroku redis:credentials', async () => {
it('heroku redis:credentials', async function () {
try {
await run(`redis:credentials ${appFlag}`)
} catch (error:any) {
expect(error.message).to.contain('No Redis instances found')
}
})

it('heroku regions', async () => {
it('heroku regions', async function () {
const {stdout} = await run('regions')
expect(stdout).to.contain('ID')
expect(stdout).to.contain('Location')
expect(stdout).to.contain('Runtime')
})

it('heroku run', async () => {
it('heroku run', async function () {
const {stdout} = await run(['run', '--size=private-s', '--exit-code', appFlag, 'echo', 'it works!'].join(' '))
expect(stdout).to.contain('it works!')
})

it('heroku sessions', async () => {
it('heroku sessions', async function () {
const {stdout} = await run('sessions')
expect(stdout).to.contain('No OAuth sessions.')
})

it('heroku spaces', async () => {
it('heroku spaces', async function () {
try {
await run('spaces')
} catch (error: any) {
expect(error.message).to.contain('You do not have access to any spaces')
}
})

it('heroku status', async () => {
it('heroku status', async function () {
const {stdout} = await run('status')
expect(stdout).to.contain('Apps:')
expect(stdout).to.contain('Data:')
expect(stdout).to.contain('Tools:')
})

it('heroku version', async () => {
it('heroku version', async function () {
const {stdout} = await run('version')
expect(stdout).to.match(/^heroku\//)
})

it('heroku webhooks', async () => {
it('heroku webhooks', async function () {
const {stdout} = await run(`webhooks ${appFlag}`)
expect(stdout).to.contain('has no webhooks')
})
})

describe('cli general', () => {
it('asserts oclif plugins are in core', async () => {
describe('cli general', function () {
it('asserts oclif plugins are in core', async function () {
const cmd = await run('plugins --core')
expect(cmd.stdout).to.contain('@oclif/plugin-commands')
expect(cmd.stdout).to.contain('@oclif/plugin-help')
Expand All @@ -198,7 +198,7 @@ describe('@acceptance smoke tests', () => {
expect(cmd.stdout).to.contain('@oclif/plugin-which')
})

it('heroku commands', async () => {
it('heroku commands', async function () {
const removeSpaces = (str: string) => str.replace(/ /g, '')
const {stdout} = await run('commands')
const commandsByline = stdout.split('\n')
Expand All @@ -210,7 +210,7 @@ describe('@acceptance smoke tests', () => {
})
})

it('asserts monorepo plugins are in core', async () => {
it('asserts monorepo plugins are in core', async function () {
let paths = await globby(['packages/*/package.json'])
const cmd = await run('plugins --core')
paths = paths.map((p: string) => p.replace('packages/', '').replace('/package.json', ''))
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/integration/access.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, test} from '@oclif/test'

describe('access', () => {
describe('access', function () {
test
.stdout()
.command(['access', '--app=heroku-cli-ci-smoke-test-app'])
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/integration/logs.integration.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, test} from '@oclif/test'

describe('logs', () => {
describe('logs', function () {
test
.stdout()
.command(['logs', '--app=heroku-cli-ci-smoke-test-app'])
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/test/integration/run.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const testFactory = () => {
})
}

describe('run', () => {
describe('run', function () {
testFactory()
.command(['run', '--app=heroku-cli-ci-smoke-test-app', 'echo 1 2 3'])
.it('runs a command', async ctx => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {expect, test} from '@oclif/test'

describe('run:detached', () => {
describe('run:detached', function () {
test
.stdout()
.command(['run:detached', '--app=heroku-cli-ci-smoke-test-app', 'echo 1 2 3'])
Expand Down
5 changes: 4 additions & 1 deletion packages/cli/test/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@
"extends": "../tsconfig",
"compilerOptions": {
"sourceMap": true,
"rootDirs": ["./", "../src"]
"rootDirs": ["./", "../src"],
"types": [
"mocha"
]
},
"include": [
"./**/*",
Expand Down
Loading

0 comments on commit 5b1d92f

Please sign in to comment.