diff --git a/packages/buildpacks/.eslintignore b/packages/buildpacks/.eslintignore new file mode 100644 index 0000000000..a65b41774a --- /dev/null +++ b/packages/buildpacks/.eslintignore @@ -0,0 +1 @@ +lib diff --git a/packages/buildpacks/.eslintrc b/packages/buildpacks/.eslintrc new file mode 100644 index 0000000000..7c4a11dc71 --- /dev/null +++ b/packages/buildpacks/.eslintrc @@ -0,0 +1,9 @@ +{ + "extends": [ + "oclif", + "oclif-typescript" + ], + "rules": { + "unicorn/no-abusive-eslint-disable": "off" + } +} diff --git a/packages/buildpacks/package.json b/packages/buildpacks/package.json index a8c9893b71..2d5a2dae51 100644 --- a/packages/buildpacks/package.json +++ b/packages/buildpacks/package.json @@ -21,7 +21,6 @@ "@oclif/dev-cli": "^1.21.3", "@oclif/plugin-help": "^2.1.6", "@oclif/test": "^1.2.4", - "@oclif/tslint": "^3.1.1", "@types/ansi-styles": "^3.2.1", "@types/chai": "^4.1.7", "@types/lodash": "^4.14.123", @@ -31,6 +30,9 @@ "@types/node-fetch": "^2.1.6", "@types/supports-color": "^5.3.0", "chai": "^4.2.0", + "eslint": "^6.7.2", + "eslint-config-oclif": "^3.1.0", + "eslint-config-oclif-typescript": "^0.1.0", "globby": "^9.0.0", "mocha": "^5", "nock": "^10.0.6", @@ -38,7 +40,6 @@ "tmp": "^0.0.33", "ts-node": "^8.0.2", "tslib": "^1", - "tslint": "^5", "typescript": "3.3.3333" }, "engines": { @@ -65,11 +66,13 @@ }, "repository": "heroku/cli", "scripts": { + "lint": "eslint . --ext .ts --config .eslintrc", "postpack": "rm -f oclif.manifest.json npm-shrinkwrap.json", - "posttest": "tsc -p test --noEmit && tslint -p test -t stylish", "prepack": "rm -rf lib && tsc && oclif-dev manifest && oclif-dev readme && npm shrinkwrap", "prepare": "rm -rf lib && tsc", + "pretest": "tsc -p test --noEmit", "test": "nyc mocha --forbid-only \"test/**/*.test.ts\"", + "posttest": "yarn lint", "version": "oclif-dev readme && git add README.md" } } diff --git a/packages/buildpacks/src/buildpacks.ts b/packages/buildpacks/src/buildpacks.ts index 01d308cdf0..8dc3a4db0a 100644 --- a/packages/buildpacks/src/buildpacks.ts +++ b/packages/buildpacks/src/buildpacks.ts @@ -5,19 +5,21 @@ import {cli} from 'cli-ux' import {findIndex as lodashFindIndex} from 'lodash' import {Result} from 'true-myth' +// eslint-disable-next-line node/no-missing-require const push = require('./push') const validUrl = require('valid-url') export type BuildpackResponse = { buildpack: { - url: string, - name: string, - }, - ordinal: number + url: string; + name: string; + }; + ordinal: number; } export class BuildpackCommand { heroku: APIClient + registry: BuildpackRegistry constructor(heroku: APIClient) { @@ -26,12 +28,12 @@ export class BuildpackCommand { } async fetch(app: string): Promise { - let buildpacks = await this.heroku.get(`/apps/${app}/buildpack-installations`) + const buildpacks = await this.heroku.get(`/apps/${app}/buildpack-installations`) return this.mapBuildpackResponse(buildpacks) } mapBuildpackResponse(buildpacks: {body: any}): BuildpackResponse[] { - let body = buildpacks.body + const body = buildpacks.body return body.map((bp: BuildpackResponse) => { bp.buildpack.url = bp.buildpack.url.replace(/^urn:buildpack:/, '') return bp @@ -54,6 +56,7 @@ export class BuildpackCommand { } Result.match({ + // eslint-disable-next-line @typescript-eslint/no-empty-function Ok: _ => {}, Err: err => { cli.error(`Could not find the buildpack: ${buildpack}. ${err}`, {exit: 1}) @@ -61,16 +64,16 @@ export class BuildpackCommand { }, BuildpackRegistry.isValidBuildpackSlug(buildpack)) try { - let response = await this.registry.buildpackExists(buildpack) - let body = await response.json() + const response = await this.registry.buildpackExists(buildpack) + const body = await response.json() return body.blob_url - } catch (err) { - if (err.statusCode === 404) { + } catch (error) { + if (error.statusCode === 404) { cli.error(`${buildpack} is not in the buildpack registry.`, {exit: 1}) - } else if (err.statusCode) { - cli.error(`${err.statusCode}: ${err.message}`, {exit: 1}) + } else if (error.statusCode) { + cli.error(`${error.statusCode}: ${error.message}`, {exit: 1}) } else { - cli.error(err.message, {exit: 1}) + cli.error(error.message, {exit: 1}) } } @@ -78,7 +81,7 @@ export class BuildpackCommand { } async findUrl(buildpacks: BuildpackResponse[], buildpack: string): Promise { - let mappedUrl = await this.registryNameToUrl(buildpack) + const mappedUrl = await this.registryNameToUrl(buildpack) return lodashFindIndex(buildpacks, (b: BuildpackResponse) => { return b.buildpack.url === buildpack || b.buildpack.url === mappedUrl }) @@ -95,30 +98,29 @@ export class BuildpackCommand { return lodashFindIndex(buildpacks, function (b: BuildpackResponse) { return b.ordinal + 1 === index }) - } else { - return -1 } + return -1 } async mutate(app: string, buildpacks: BuildpackResponse[], spliceIndex: number, buildpack: string, command: 'add' | 'set' | 'remove'): Promise { - let buildpackUpdates = buildpacks.map(function (b: BuildpackResponse) { + const buildpackUpdates = buildpacks.map(function (b: BuildpackResponse) { return {buildpack: b.buildpack.url} }) - let howmany = (command === 'add') ? 0 : 1 - let urls = (command === 'remove') ? [] : [{buildpack: await this.registryNameToUrl(buildpack)}] + const howmany = (command === 'add') ? 0 : 1 + const urls = (command === 'remove') ? [] : [{buildpack: await this.registryNameToUrl(buildpack)}] - let indexes: any[] = [spliceIndex, howmany] - let array: any[] = indexes.concat(urls) + const indexes: any[] = [spliceIndex, howmany] + const array: any[] = indexes.concat(urls) Array.prototype.splice.apply(buildpackUpdates, array as any) return this.put(app, buildpackUpdates) } async put(app: string, buildpackUpdates: {buildpack: string}[]): Promise { - let buildpacks = await this.heroku.put(`/apps/${app}/buildpack-installations`, { + const buildpacks = await this.heroku.put(`/apps/${app}/buildpack-installations`, { headers: {Range: ''}, - body: {updates: buildpackUpdates} + body: {updates: buildpackUpdates}, }) return this.mapBuildpackResponse(buildpacks) @@ -136,12 +138,14 @@ export class BuildpackCommand { } registryUrlToName(buildpack: string, registryOnly = false): string { + // eslint-disable-next-line no-useless-escape let match = /^https:\/\/buildpack\-registry\.s3\.amazonaws\.com\/buildpacks\/([\w\-]+\/[\w\-]+).tgz$/.exec(buildpack) if (match) { return match[1] } if (!registryOnly) { + // eslint-disable-next-line no-useless-escape match = /^https:\/\/codon\-buildpacks\.s3\.amazonaws\.com\/buildpacks\/heroku\/([\w\-]+).tgz$/.exec(buildpack) if (match) { return `heroku/${match[1]}` @@ -154,8 +158,8 @@ export class BuildpackCommand { async clear(app: string, command: 'clear' | 'remove', action: 'cleared' | 'removed') { await this.put(app, []) - let configVars: any = await this.heroku.get(`/apps/${app}/config-vars`) - let message = `Buildpack${command === 'clear' ? 's' : ''} ${action}.` + const configVars: any = await this.heroku.get(`/apps/${app}/config-vars`) + const message = `Buildpack${command === 'clear' ? 's' : ''} ${action}.` if (configVars.body.BUILDPACK_URL) { cli.log(message) cli.warn('The BUILDPACK_URL config var is still set and will be used for the next release') diff --git a/packages/buildpacks/src/commands/buildpacks/add.ts b/packages/buildpacks/src/commands/buildpacks/add.ts index 7b6a8723e8..dc114e623d 100644 --- a/packages/buildpacks/src/commands/buildpacks/add.ts +++ b/packages/buildpacks/src/commands/buildpacks/add.ts @@ -4,42 +4,44 @@ import {BuildpackCommand} from '../../buildpacks' export default class Add extends Command { static description = 'add new app buildpack, inserting into list of buildpacks if necessary' + static flags = { app: Flags.app({required: true}), remote: Flags.remote(), index: Flags.integer({ description: 'the 1-based index of the URL in the list of URLs', - char: 'i' - }) + char: 'i', + }), } + static args = [ { name: 'buildpack', required: true, - description: 'namespace/name of the buildpack' - } + description: 'namespace/name of the buildpack', + }, ] async run() { - let {args, flags} = this.parse(Add) - let buildpackCommand = new BuildpackCommand(this.heroku) + const {args, flags} = this.parse(Add) + const buildpackCommand = new BuildpackCommand(this.heroku) if (flags.index !== undefined) { buildpackCommand.validateIndex(flags.index) } - let buildpacks = await buildpackCommand.fetch(flags.app) + const buildpacks = await buildpackCommand.fetch(flags.app) await buildpackCommand.validateUrlNotSet(buildpacks, args.buildpack) let spliceIndex: number if (flags.index === undefined) { spliceIndex = buildpacks.length } else { - let foundIndex = buildpackCommand.findIndex(buildpacks, flags.index) + const foundIndex = buildpackCommand.findIndex(buildpacks, flags.index) spliceIndex = (foundIndex === -1) ? buildpacks.length : foundIndex } - let buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'add') + const buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'add') buildpackCommand.displayUpdate(flags.app, flags.remote || '', buildpackUpdates, 'added') } } diff --git a/packages/buildpacks/src/commands/buildpacks/clear.ts b/packages/buildpacks/src/commands/buildpacks/clear.ts index 82a18a7cc7..75e598a7ad 100644 --- a/packages/buildpacks/src/commands/buildpacks/clear.ts +++ b/packages/buildpacks/src/commands/buildpacks/clear.ts @@ -4,14 +4,15 @@ import {BuildpackCommand} from '../../buildpacks' export default class Clear extends Command { static description = 'clear all buildpacks set on the app' + static flags = { app: Flags.app({required: true}), - remote: Flags.remote() + remote: Flags.remote(), } async run() { - let {flags} = this.parse(Clear) - let buildpackCommand = new BuildpackCommand(this.heroku) + const {flags} = this.parse(Clear) + const buildpackCommand = new BuildpackCommand(this.heroku) await buildpackCommand.clear(flags.app, 'clear', 'cleared') } } diff --git a/packages/buildpacks/src/commands/buildpacks/index.ts b/packages/buildpacks/src/commands/buildpacks/index.ts index 0722057283..5ee4f175c4 100644 --- a/packages/buildpacks/src/commands/buildpacks/index.ts +++ b/packages/buildpacks/src/commands/buildpacks/index.ts @@ -5,16 +5,17 @@ import {BuildpackCommand} from '../../buildpacks' export default class Index extends Command { static description = 'display the buildpacks for an app' + static flags = { app: Flags.app({required: true}), - remote: Flags.remote() + remote: Flags.remote(), } async run() { - let {flags} = this.parse(Index) - let buildpacksCommand = new BuildpackCommand(this.heroku) + const {flags} = this.parse(Index) + const buildpacksCommand = new BuildpackCommand(this.heroku) - let buildpacks = await buildpacksCommand.fetch(flags.app) + const buildpacks = await buildpacksCommand.fetch(flags.app) if (buildpacks.length === 0) { this.log(`${flags.app} has no Buildpack URL set.`) } else { diff --git a/packages/buildpacks/src/commands/buildpacks/info.ts b/packages/buildpacks/src/commands/buildpacks/info.ts index 34681af4a8..5b104ab92e 100644 --- a/packages/buildpacks/src/commands/buildpacks/info.ts +++ b/packages/buildpacks/src/commands/buildpacks/info.ts @@ -6,26 +6,28 @@ import {BuildpackRegistry} from '@heroku/buildpack-registry' export default class Info extends Command { static description = 'fetch info about a buildpack' + static args = [ { name: 'buildpack', required: true, - description: 'namespace/name of the buildpack' - } + description: 'namespace/name of the buildpack', + }, ] async run() { - let {args} = this.parse(Info) - let registry = new BuildpackRegistry() + const {args} = this.parse(Info) + const registry = new BuildpackRegistry() Result.match({ + // eslint-disable-next-line @typescript-eslint/no-empty-function Ok: _ => {}, Err: err => { this.error(`Could not publish the buildpack.\n${err}`) }, }, BuildpackRegistry.isValidBuildpackSlug(args.buildpack)) - let result = await registry.info(args.buildpack) + const result = await registry.info(args.buildpack) Result.match({ Ok: buildpack => { cli.styledHeader(args.buildpack) @@ -37,7 +39,7 @@ export default class Info extends Command { } else { cli.error(`Problems finding buildpack info: ${err.description}`) } - } + }, }, result) } } diff --git a/packages/buildpacks/src/commands/buildpacks/remove.ts b/packages/buildpacks/src/commands/buildpacks/remove.ts index bd9cc4918f..32069c3007 100644 --- a/packages/buildpacks/src/commands/buildpacks/remove.ts +++ b/packages/buildpacks/src/commands/buildpacks/remove.ts @@ -5,24 +5,26 @@ import {BuildpackCommand} from '../../buildpacks' export default class Remove extends Command { static description = 'remove a buildpack set on the app' + static flags = { app: Flags.app({required: true}), remote: Flags.remote(), index: Flags.integer({ description: 'the 1-based index of the URL to remove from the list of URLs', - char: 'i' - }) + char: 'i', + }), } + static args = [ { name: 'buildpack', - description: 'namespace/name of the buildpack' - } + description: 'namespace/name of the buildpack', + }, ] async run() { - let {args, flags} = this.parse(Remove) - let buildpackCommand = new BuildpackCommand(this.heroku) + const {args, flags} = this.parse(Remove) + const buildpackCommand = new BuildpackCommand(this.heroku) if (flags.index && args.buildpack) { cli.error('Please choose either index or Buildpack, but not both.', {exit: 1}) @@ -31,7 +33,7 @@ export default class Remove extends Command { cli.error('Usage: heroku buildpacks:remove [BUILDPACK_URL]. Must specify a buildpack to remove, either by index or URL.') } - let buildpacks = await buildpackCommand.fetch(flags.app) + const buildpacks = await buildpackCommand.fetch(flags.app) if (buildpacks.length === 0) { cli.error(`No buildpacks were found. Next release on ${flags.app} will detect buildpack normally.`, {exit: 1}) } @@ -51,7 +53,7 @@ export default class Remove extends Command { if (buildpacks.length === 1) { await buildpackCommand.clear(flags.app, 'remove', 'removed') } else { - let buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'remove') + const buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'remove') buildpackCommand.displayUpdate(flags.app, flags.remote || '', buildpackUpdates, 'removed') } } diff --git a/packages/buildpacks/src/commands/buildpacks/search.ts b/packages/buildpacks/src/commands/buildpacks/search.ts index 5e7d82937e..579af48a45 100644 --- a/packages/buildpacks/src/commands/buildpacks/search.ts +++ b/packages/buildpacks/src/commands/buildpacks/search.ts @@ -6,33 +6,34 @@ import {BuildpackBody, BuildpackRegistry, Category} from '@heroku/buildpack-regi export default class Search extends Command { static description = 'search for buildpacks' + static flags = { namespace: Flags.string({description: 'buildpack namespaces to filter on using a comma separated list'}), name: Flags.string({description: 'buildpack names to filter on using a comma separated list '}), - description: Flags.string({description: 'buildpack description to filter on'}) + description: Flags.string({description: 'buildpack description to filter on'}), } + static args = [ { name: 'term', - description: 'search term that searches across name, namespace, and description' - } + description: 'search term that searches across name, namespace, and description', + }, ] async run() { - let {args, flags} = this.parse(Search) - let registry: BuildpackRegistry + const {args, flags} = this.parse(Search) let searchResults: BuildpackBody[] - registry = new BuildpackRegistry() + const registry = new BuildpackRegistry() if (args.term) { - let uniqueBuildpacks = new Map() - let array = ((await registry.search(args.term, undefined, undefined)).unwrapOr([])) - .concat((await registry.search(undefined, args.term, undefined)).unwrapOr([])) - .concat((await registry.search(undefined, undefined, args.term)).unwrapOr([])) + const uniqueBuildpacks = new Map() + const array = ((await registry.search(args.term, undefined, undefined)).unwrapOr([])) + .concat((await registry.search(undefined, args.term, undefined)).unwrapOr([])) + .concat((await registry.search(undefined, undefined, args.term)).unwrapOr([])) array - .forEach((element: BuildpackBody) => { - uniqueBuildpacks.set(`${element.namespace}/${element.name}`, element) - }) + .forEach((element: BuildpackBody) => { + uniqueBuildpacks.set(`${element.namespace}/${element.name}`, element) + }) searchResults = [...uniqueBuildpacks.values()] } else { @@ -40,25 +41,25 @@ export default class Search extends Command { } type TableRow = { - buildpack: string, - category: Category, - description: string, + buildpack: string; + category: Category; + description: string; } - let buildpacks: TableRow[] = searchResults.map((buildpack: BuildpackBody) => { + const buildpacks: TableRow[] = searchResults.map((buildpack: BuildpackBody) => { return { buildpack: `${buildpack.namespace}/${buildpack.name}`, category: buildpack.category, - description: buildpack.description + description: buildpack.description, } }) const trunc = (value: string, _: string) => truncate(value, {length: 35, omission: '…'}) - let displayTable = (buildpacks: TableRow[]) => { + const displayTable = (buildpacks: TableRow[]) => { cli.table(buildpacks, { columns: [ {key: 'buildpack', label: 'Buildpack'}, {key: 'category', label: 'Category'}, - {key: 'description', label: 'Description', format: trunc} - ] + {key: 'description', label: 'Description', format: trunc}, + ], }) } diff --git a/packages/buildpacks/src/commands/buildpacks/set.ts b/packages/buildpacks/src/commands/buildpacks/set.ts index 1d821b086c..ea2c398a80 100644 --- a/packages/buildpacks/src/commands/buildpacks/set.ts +++ b/packages/buildpacks/src/commands/buildpacks/set.ts @@ -4,31 +4,33 @@ import {BuildpackCommand} from '../../buildpacks' export default class Set extends Command { static description: 'set new app buildpack, overwriting into list of buildpacks if necessary' + static flags = { app: Flags.app({required: true}), remote: Flags.remote(), index: Flags.integer({ description: 'the 1-based index of the URL in the list of URLs', - char: 'i' - }) + char: 'i', + }), } + static args = [ { name: 'buildpack', required: true, - description: 'namespace/name of the buildpack' - } + description: 'namespace/name of the buildpack', + }, ] async run() { - let {args, flags} = this.parse(Set) + const {args, flags} = this.parse(Set) if (flags.index && flags.index < 0) { this.error('Invalid index. Must be greater than 0.') } - let buildpackCommand = new BuildpackCommand(this.heroku) - let buildpacks = await buildpackCommand.fetch(flags.app) + const buildpackCommand = new BuildpackCommand(this.heroku) + const buildpacks = await buildpackCommand.fetch(flags.app) await buildpackCommand.validateUrlNotSet(buildpacks, args.buildpack) @@ -36,11 +38,11 @@ export default class Set extends Command { if (flags.index === undefined) { spliceIndex = 0 } else { - let foundIndex = buildpackCommand.findIndex(buildpacks, flags.index) + const foundIndex = buildpackCommand.findIndex(buildpacks, flags.index) spliceIndex = (foundIndex === -1) ? buildpacks.length : foundIndex } - let buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'set') + const buildpackUpdates = await buildpackCommand.mutate(flags.app, buildpacks, spliceIndex, args.buildpack, 'set') buildpackCommand.displayUpdate(flags.app, flags.remote || '', buildpackUpdates, 'set') } } diff --git a/packages/buildpacks/src/commands/buildpacks/versions.ts b/packages/buildpacks/src/commands/buildpacks/versions.ts index c6f4520e6d..1d10fd5e86 100644 --- a/packages/buildpacks/src/commands/buildpacks/versions.ts +++ b/packages/buildpacks/src/commands/buildpacks/versions.ts @@ -6,31 +6,32 @@ import {BuildpackRegistry, RevisionBody} from '@heroku/buildpack-registry' export default class Versions extends Command { static description = 'list versions of a buildpack' + static args = [ { name: 'buildpack', required: true, - description: 'namespace/name of the buildpack' - } + description: 'namespace/name of the buildpack', + }, ] async run() { - let {args} = this.parse(Versions) - let registry: BuildpackRegistry - let herokuAuth = this.heroku.auth || '' + const {args} = this.parse(Versions) + const herokuAuth = this.heroku.auth || '' if (herokuAuth === '') { this.error('You need to be logged in to run this command.') } - registry = new BuildpackRegistry() + const registry = new BuildpackRegistry() Result.match({ + // eslint-disable-next-line @typescript-eslint/no-empty-function Ok: _ => {}, Err: err => { this.error(`Could not find the buildpack.\n${err}`) }, }, BuildpackRegistry.isValidBuildpackSlug(args.buildpack)) - let result = await registry.listVersions(args.buildpack) + const result = await registry.listVersions(args.buildpack) Result.match({ Ok: versions => { cli.table(versions.sort((a: RevisionBody, b: RevisionBody) => { @@ -39,8 +40,8 @@ export default class Versions extends Command { columns: [ {key: 'release', label: 'Version'}, {key: 'created_at', label: 'Released At'}, - {key: 'status', label: 'Status'} - ] + {key: 'status', label: 'Status'}, + ], }) }, Err: err => { @@ -49,7 +50,7 @@ export default class Versions extends Command { } else { this.error(`Problem fetching versions, ${err.status}: ${err.description}`) } - } + }, }, result) } } diff --git a/packages/buildpacks/test/commands/buildpacks/add.test.ts b/packages/buildpacks/test/commands/buildpacks/add.test.ts index fb3cce56a1..0c768d4e78 100644 --- a/packages/buildpacks/test/commands/buildpacks/add.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/add.test.ts @@ -2,233 +2,231 @@ import Nock from '@fancy-test/nock' import {Fixture} from '@heroku/buildpack-registry' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' -nock.disableNetConnect() -const test = otest.register('nock', Nock) import {BuildpackInstallationsStub as Stubber} from '../../helpers/buildpack-installations-stub' +nock.disableNetConnect() +const test = otest.register('nock', Nock) describe('buildpacks:add', () => { describe('URL', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - let registry = new Map() - registry.set('https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz', {url: 'urn:buildpack:hone/test', name: 'hone/test'}) - - Stubber.get(api) - Stubber.put(api, ['https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz'], registry) - }) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - let buildpack = Fixture.buildpack({ - namespace: 'hone', - name: 'test', - blob_url: 'https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz', - }) - - api - .get('/buildpacks/hone%2Ftest') - .times(2) - .reply(200, buildpack) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'hone/test', '-a', 'example']) - .it('# maps buildpack names', ctx => { - // TODO: On the upgrade to Node 12 this produced an error related to - // an older version of nock used by fancy-nock - // ctx.stderr contained: 'OutgoingMessage.prototype._headers is deprecated' - // expect(ctx.stderr).to.equal('') - - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use hone/test. + .nock('https://api.heroku.com', (api: nock.Scope) => { + const registry = new Map() + registry.set('https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz', {url: 'urn:buildpack:hone/test', name: 'hone/test'}) + + Stubber.get(api) + Stubber.put(api, ['https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz'], registry) + }) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + const buildpack = Fixture.buildpack({ + namespace: 'hone', + name: 'test', + blob_url: 'https://buildpack-registry.s3.amazonaws.com/buildpacks/hone/test.tgz', + }) + + api + .get('/buildpacks/hone%2Ftest') + .times(2) + .reply(200, buildpack) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'hone/test', '-a', 'example']) + .it('# maps buildpack names', ctx => { + // TODO: On the upgrade to Node 12 this produced an error related to + // an older version of nock used by fancy-nock + // ctx.stderr contained: 'OutgoingMessage.prototype._headers is deprecated' + // expect(ctx.stderr).to.equal('') + + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use hone/test. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - Stubber.put(api, ['https://github.com/heroku/heroku-buildpack-ruby']) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with no buildpacks adds the buildpack URL', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + Stubber.put(api, ['https://github.com/heroku/heroku-buildpack-ruby']) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with no buildpacks adds the buildpack URL', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-java']) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with one existing buildpack adds a buildpack URL to the end of the list', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-java']) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with one existing buildpack adds a buildpack URL to the end of the list', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-ruby Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with two existing buildpacks successfully adds a buildpack URL to the end of the list', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with two existing buildpacks successfully adds a buildpack URL to the end of the list', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-nodejs 3. https://github.com/heroku/heroku-buildpack-ruby Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://github.com/foobar/foobar']) - }) - .stderr() - .command(['buildpacks:add', 'https://github.com/foobar/foobar', '-a', 'example']) - .catch('The buildpack https://github.com/foobar/foobar is already set on your app.') - .it('# errors out when already exists') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://github.com/foobar/foobar']) + }) + .stderr() + .command(['buildpacks:add', 'https://github.com/foobar/foobar', '-a', 'example']) + .catch('The buildpack https://github.com/foobar/foobar is already set on your app.') + .it('# errors out when already exists') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz']) - }) - .stderr() - .command(['buildpacks:add', 'https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz', '-a', 'example']) - .catch('The buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz is already set on your app.') - .it('# errors out on unmapped codon urls') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz']) + }) + .stderr() + .command(['buildpacks:add', 'https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz', '-a', 'example']) + .catch('The buildpack https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/jvm-common.tgz is already set on your app.') + .it('# errors out on unmapped codon urls') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - { - url: 'urn:buildpack:heroku/ruby', - name: 'heroku/ruby', - } - ]) - }) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - let buildpack = Fixture.buildpack({ - namespace: 'heroku', - name: 'ruby', - blob_url: 'https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz', - }) - - api - .get('/buildpacks/heroku%2Fruby') - .reply(200, buildpack) - }) - .command(['buildpacks:add', 'heroku/ruby', '-a', 'example']) - .catch('The buildpack heroku/ruby is already set on your app.') - .it('# errors out when already exists urn') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + { + url: 'urn:buildpack:heroku/ruby', + name: 'heroku/ruby', + }, + ]) + }) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + const buildpack = Fixture.buildpack({ + namespace: 'heroku', + name: 'ruby', + blob_url: 'https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/ruby.tgz', + }) + + api + .get('/buildpacks/heroku%2Fruby') + .reply(200, buildpack) + }) + .command(['buildpacks:add', 'heroku/ruby', '-a', 'example']) + .catch('The buildpack heroku/ruby is already set on your app.') + .it('# errors out when already exists urn') }) describe('-i INDEX URL', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - Stubber.put(api, ['https://github.com/heroku/heroku-buildpack-ruby']) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .it('# with no buildpacks adds the buildpack URL with index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + Stubber.put(api, ['https://github.com/heroku/heroku-buildpack-ruby']) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .it('# with no buildpacks adds the buildpack URL with index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-java']) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - 'https://github.com/heroku/heroku-buildpack-java', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .it('# with one existing buildpack inserts a buildpack URL at index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-java']) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + 'https://github.com/heroku/heroku-buildpack-java', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .it('# with one existing buildpack inserts a buildpack URL at index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-ruby 2. https://github.com/heroku/heroku-buildpack-java Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '2', '-a', 'example']) - .it('# with two existing buildpacks successfully inserts a buildpack URL at index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack added. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '2', '-a', 'example']) + .it('# with two existing buildpacks successfully inserts a buildpack URL at index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack added. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-ruby 3. https://github.com/heroku/heroku-buildpack-nodejs Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', 'notinteger', '-a', 'example']) - .catch('Expected an integer but received: notinteger') - .it('# returns an error message when i is not an integer') + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', 'notinteger', '-a', 'example']) + .catch('Expected an integer but received: notinteger') + .it('# returns an error message when i is not an integer') test - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '-1', '-a', 'example']) - .catch('Invalid index. Must be greater than 0.') - .it('# returns an error message when i < 0') + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '-1', '-a', 'example']) + .catch('Invalid index. Must be greater than 0.') + .it('# returns an error message when i < 0') test - .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '0', '-a', 'example']) - .catch('Invalid index. Must be greater than 0.') - .it('# returns an error message when i == 0') + .command(['buildpacks:add', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '0', '-a', 'example']) + .catch('Invalid index. Must be greater than 0.') + .it('# returns an error message when i == 0') }) }) diff --git a/packages/buildpacks/test/commands/buildpacks/clear.test.ts b/packages/buildpacks/test/commands/buildpacks/clear.test.ts index 82e047026e..69348ecd4b 100644 --- a/packages/buildpacks/test/commands/buildpacks/clear.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/clear.test.ts @@ -1,57 +1,55 @@ import Nock from '@fancy-test/nock' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' -nock.disableNetConnect() -const test = otest.register('nock', Nock) import {BuildpackInstallationsStub as Stubber} from '../../helpers/buildpack-installations-stub' import {unwrap} from '../../unwrap' +nock.disableNetConnect() +const test = otest.register('nock', Nock) describe('buildpacks:clear', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {}) - }) - .stdout() - .command(['buildpacks:clear', '-a', 'example']) - .it('# clears the buildpack URL', ctx => { - nock('https://api.heroku.com') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {}) + }) + .stdout() + .command(['buildpacks:clear', '-a', 'example']) + .it('# clears the buildpack URL', ctx => { + nock('https://api.heroku.com') - expect(ctx.stdout).to.equal('Buildpacks cleared. Next release on example will detect buildpacks normally.\n') - }) + expect(ctx.stdout).to.equal('Buildpacks cleared. Next release on example will detect buildpacks normally.\n') + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {BUILDPACK_URL: 'https://github.com/foo/foo'}) - }) - .stdout() - .stderr() - .command(['buildpacks:clear', '-a', 'example']) - .it('# clears and warns about buildpack URL config var', ctx => { - expect(ctx.stdout).to.equal('Buildpacks cleared.\n') - expect(unwrap(ctx.stderr)).to.equal('Warning: The BUILDPACK_URL config var is still set and will be used for the next release\n') - }) + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {BUILDPACK_URL: 'https://github.com/foo/foo'}) + }) + .stdout() + .stderr() + .command(['buildpacks:clear', '-a', 'example']) + .it('# clears and warns about buildpack URL config var', ctx => { + expect(ctx.stdout).to.equal('Buildpacks cleared.\n') + expect(unwrap(ctx.stderr)).to.equal('Warning: The BUILDPACK_URL config var is still set and will be used for the next release\n') + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {LANGUAGE_PACK_URL: 'https://github.com/foo/foo'}) - }) - .stdout() - .stderr() - .command(['buildpacks:clear', '-a', 'example']) - .it('# clears and warns about language pack URL config var', ctx => { - expect(ctx.stdout).to.equal('Buildpacks cleared.\n') - expect(unwrap(ctx.stderr)).to.equal('Warning: The LANGUAGE_PACK_URL config var is still set and will be used for the next release\n') - }) + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {LANGUAGE_PACK_URL: 'https://github.com/foo/foo'}) + }) + .stdout() + .stderr() + .command(['buildpacks:clear', '-a', 'example']) + .it('# clears and warns about language pack URL config var', ctx => { + expect(ctx.stdout).to.equal('Buildpacks cleared.\n') + expect(unwrap(ctx.stderr)).to.equal('Warning: The LANGUAGE_PACK_URL config var is still set and will be used for the next release\n') + }) }) diff --git a/packages/buildpacks/test/commands/buildpacks/index.test.ts b/packages/buildpacks/test/commands/buildpacks/index.test.ts index 06da8f5b49..fae4edaafe 100644 --- a/packages/buildpacks/test/commands/buildpacks/index.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/index.test.ts @@ -1,108 +1,106 @@ import Nock from '@fancy-test/nock' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' -nock.disableNetConnect() -const test = otest.register('nock', Nock) import {BuildpackInstallationsStub as Stubber} from '../../helpers/buildpack-installations-stub' +nock.disableNetConnect() +const test = otest.register('nock', Nock) describe('buildpacks', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-ruby']) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# displays the buildpack URL', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `=== example Buildpack URL + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-ruby']) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# displays the buildpack URL', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `=== example Buildpack URL https://github.com/heroku/heroku-buildpack-ruby `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [{url: 'urn:buildpack:heroku/ruby', name: 'heroku/ruby'}]) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# maps buildpack urns to names', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `=== example Buildpack URL + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [{url: 'urn:buildpack:heroku/ruby', name: 'heroku/ruby'}]) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# maps buildpack urns to names', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `=== example Buildpack URL heroku/ruby `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz']) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# does not map buildpack s3 to names', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `=== example Buildpack URL + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz']) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# does not map buildpack s3 to names', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `=== example Buildpack URL https://codon-buildpacks.s3.amazonaws.com/buildpacks/heroku/ruby.tgz `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# with no buildpack URL set does not display a buildpack URL', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `example has no Buildpack URL set. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# with no buildpack URL set does not display a buildpack URL', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `example has no Buildpack URL set. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# with two buildpack URLs set displays the buildpack URL', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `=== example Buildpack URLs + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# with two buildpack URLs set displays the buildpack URL', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `=== example Buildpack URLs 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-ruby `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz', - 'https://buildpack-registry.s3.amazonaws.com/buildpacks/rust-lang/rust.tgz', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks', '-a', 'example']) - .it('# returns the buildpack registry name back', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `=== example Buildpack URLs + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://buildpack-registry.s3.amazonaws.com/buildpacks/heroku/java.tgz', + 'https://buildpack-registry.s3.amazonaws.com/buildpacks/rust-lang/rust.tgz', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks', '-a', 'example']) + .it('# returns the buildpack registry name back', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `=== example Buildpack URLs 1. heroku/java 2. rust-lang/rust `) - }) + }) }) diff --git a/packages/buildpacks/test/commands/buildpacks/info.test.ts b/packages/buildpacks/test/commands/buildpacks/info.test.ts index f8672c4184..7917ef8eb1 100644 --- a/packages/buildpacks/test/commands/buildpacks/info.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/info.test.ts @@ -2,54 +2,52 @@ import Nock from '@fancy-test/nock' import {Fixture} from '@heroku/buildpack-registry' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' nock.disableNetConnect() const test = otest.register('nock', Nock) describe('buildpacks:info', () => { test - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/heroku%2Fruby') - .reply(200, Fixture.buildpack({ - name: 'ruby', - source: { - type: 'github', - owner: 'heroku', - repo: 'heroku-buildpack-ruby', - }, - })) - .get('/buildpacks/heroku%2Fruby/revisions') - .reply(200, [Fixture.revision()]) - .get('/buildpacks/heroku%2Fruby/readme') - .reply(200, Fixture.readme()) - }) - .stdout() - .command(['buildpacks:info', 'heroku/ruby']) - .it('shows info about the buildpack', ctx => { - expect(ctx.stdout).to.contain('=== heroku/ruby') - expect(ctx.stdout).to.contain('languages') - expect(ctx.stdout).to.match(/source:\s+https:\/\/github\.com\/heroku\/heroku-buildpack-ruby/) - }) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/heroku%2Fruby') + .reply(200, Fixture.buildpack({ + name: 'ruby', + source: { + type: 'github', + owner: 'heroku', + repo: 'heroku-buildpack-ruby', + }, + })) + .get('/buildpacks/heroku%2Fruby/revisions') + .reply(200, [Fixture.revision()]) + .get('/buildpacks/heroku%2Fruby/readme') + .reply(200, Fixture.readme()) + }) + .stdout() + .command(['buildpacks:info', 'heroku/ruby']) + .it('shows info about the buildpack', ctx => { + expect(ctx.stdout).to.contain('=== heroku/ruby') + expect(ctx.stdout).to.contain('languages') + expect(ctx.stdout).to.match(/source:\s+https:\/\/github\.com\/heroku\/heroku-buildpack-ruby/) + }) test - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/hone%2Ftest') - .reply(404, {}) - }) - .command(['buildpacks:info', 'hone/test']) - .catch("Could not find the buildpack 'hone/test'") - .it("handles if the buildpack doesn't exist") + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/hone%2Ftest') + .reply(404, {}) + }) + .command(['buildpacks:info', 'hone/test']) + .catch("Could not find the buildpack 'hone/test'") + .it("handles if the buildpack doesn't exist") test - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/hone%2Ftest') - .reply(500, 'some error') - }) - .command(['buildpacks:info', 'hone/test']) - .catch('Problems finding buildpack info: some error') - .it('handles case if there are errors from the API') + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/hone%2Ftest') + .reply(500, 'some error') + }) + .command(['buildpacks:info', 'hone/test']) + .catch('Problems finding buildpack info: some error') + .it('handles case if there are errors from the API') }) diff --git a/packages/buildpacks/test/commands/buildpacks/remove.test.ts b/packages/buildpacks/test/commands/buildpacks/remove.test.ts index 235be97b3e..9f80e4c2f7 100644 --- a/packages/buildpacks/test/commands/buildpacks/remove.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/remove.test.ts @@ -2,288 +2,286 @@ import Nock from '@fancy-test/nock' import {Fixture} from '@heroku/buildpack-registry' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' -nock.disableNetConnect() -const test = otest.register('nock', Nock) import {BuildpackInstallationsStub as Stubber} from '../../helpers/buildpack-installations-stub' import {unwrap} from '../../unwrap' +nock.disableNetConnect() +const test = otest.register('nock', Nock) describe('buildpacks:remove', () => { describe('-i INDEX', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-ruby']) - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {}) - }) - .stdout() - .stderr() - .command(['buildpacks:remove', '-i', '1', '-a', 'example']) - .it('# with one buildpack successfully removes index', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will detect buildpacks normally. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, ['https://github.com/heroku/heroku-buildpack-ruby']) + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {}) + }) + .stdout() + .stderr() + .command(['buildpacks:remove', '-i', '1', '-a', 'example']) + .it('# with one buildpack successfully removes index', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will detect buildpacks normally. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {LANGUAGE_PACK_URL: 'https://github.com/foo/foo'}) - }) - .stdout() - .stderr() - .command(['buildpacks:remove', '-i', '1', '-a', 'example']) - .it('# with one buildpack successfully removes index with langauge warn', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {LANGUAGE_PACK_URL: 'https://github.com/foo/foo'}) + }) + .stdout() + .stderr() + .command(['buildpacks:remove', '-i', '1', '-a', 'example']) + .it('# with one buildpack successfully removes index with langauge warn', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. `) - expect(unwrap(ctx.stderr)).to.equal('Warning: The LANGUAGE_PACK_URL config var is still set and will be used for the next release\n') - }) + expect(unwrap(ctx.stderr)).to.equal('Warning: The LANGUAGE_PACK_URL config var is still set and will be used for the next release\n') + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {BUILDPACK_URL: 'https://github.com/foo/foo'}) - }) - .stdout() - .stderr() - .command(['buildpacks:remove', '-i', '1', '-a', 'example']) - .it('# with one buildpack successfully removes index with buildpack warn', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {BUILDPACK_URL: 'https://github.com/foo/foo'}) + }) + .stdout() + .stderr() + .command(['buildpacks:remove', '-i', '1', '-a', 'example']) + .it('# with one buildpack successfully removes index with buildpack warn', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. `) - expect(unwrap(ctx.stderr)).to.equal('Warning: The BUILDPACK_URL config var is still set and will be used for the next release\n') - }) + expect(unwrap(ctx.stderr)).to.equal('Warning: The BUILDPACK_URL config var is still set and will be used for the next release\n') + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - ]) - }) - .stdout() - .command(['buildpacks:remove', '-i', '2', '-a', 'example']) - .it('# with two buildpacks successfully removes index - java', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-java. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + ]) + }) + .stdout() + .command(['buildpacks:remove', '-i', '2', '-a', 'example']) + .it('# with two buildpacks successfully removes index - java', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-java. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .command(['buildpacks:remove', '-i', '1', '-a', 'example']) - .it('# with two buildpacks successfully removes index - ruby', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .command(['buildpacks:remove', '-i', '1', '-a', 'example']) + .it('# with two buildpacks successfully removes index - ruby', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .command(['buildpacks:remove', '-i', '2', '-a', 'example']) - .it('# with three buildpacks successfully removes index', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .command(['buildpacks:remove', '-i', '2', '-a', 'example']) + .it('# with three buildpacks successfully removes index', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-ruby Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .command(['buildpacks:remove', '-i', 'notaninteger', '-a', 'example']) - .catch('Expected an integer but received: notaninteger') - .it('# returns an error message when i is not an integer') + .command(['buildpacks:remove', '-i', 'notaninteger', '-a', 'example']) + .catch('Expected an integer but received: notaninteger') + .it('# returns an error message when i is not an integer') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - }) - .command(['buildpacks:remove', '-i', '1', '-a', 'example']) - .catch('No buildpacks were found. Next release on example will detect buildpack normally.') - .it('# with no buildpacks reports an error removing index') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + }) + .command(['buildpacks:remove', '-i', '1', '-a', 'example']) + .catch('No buildpacks were found. Next release on example will detect buildpack normally.') + .it('# with no buildpacks reports an error removing index') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/foo/foo', - ]) - }) - .command(['buildpacks:remove', '-i', '2', '-a', 'example']) - .catch('Invalid index. Only valid value is 1.') - .it('# returns an error when the index > 1 and the size is one') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/foo/foo', + ]) + }) + .command(['buildpacks:remove', '-i', '2', '-a', 'example']) + .catch('Invalid index. Only valid value is 1.') + .it('# returns an error when the index > 1 and the size is one') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/foo/foo', - 'https://github.com/bar/bar' - ]) - }) - .command(['buildpacks:remove', '-i', '3', '-a', 'example']) - .catch('Invalid index. Please choose a value between 1 and 2') - .it('# returns an error when the index > size and the size > one') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/foo/foo', + 'https://github.com/bar/bar', + ]) + }) + .command(['buildpacks:remove', '-i', '3', '-a', 'example']) + .catch('Invalid index. Please choose a value between 1 and 2') + .it('# returns an error when the index > size and the size > one') }) describe('URL', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {}) - }) - .stdout() - .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with one buildpack successfully removes url', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will detect buildpacks normally. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {}) + }) + .stdout() + .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with one buildpack successfully removes url', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will detect buildpacks normally. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with two buildpacks successfully removes url', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-java. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with two buildpacks successfully removes url', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will use https://github.com/heroku/heroku-buildpack-java. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - {url: 'urn:buildpack:heroku/ruby', name: 'heroku/ruby'} - ]) - Stubber.put(api) - api - .get('/apps/example/config-vars') - .reply(200, {}) - }) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - let buildpack = Fixture.buildpack({ - name: 'ruby' - }) - api - .get('/buildpacks/heroku%2Fruby') - .reply(200, buildpack) + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + {url: 'urn:buildpack:heroku/ruby', name: 'heroku/ruby'}, + ]) + Stubber.put(api) + api + .get('/apps/example/config-vars') + .reply(200, {}) + }) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + const buildpack = Fixture.buildpack({ + name: 'ruby', }) - .stdout() - .stderr() - .command(['buildpacks:remove', 'heroku/ruby', '-a', 'example']) - .it('# remove by name should work', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will detect buildpacks normally. + api + .get('/buildpacks/heroku%2Fruby') + .reply(200, buildpack) + }) + .stdout() + .stderr() + .command(['buildpacks:remove', 'heroku/ruby', '-a', 'example']) + .it('# remove by name should work', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will detect buildpacks normally. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - }) - .command(['buildpacks:remove', 'https://github.com/bar/bar', '-a', 'example']) - .catch('No buildpacks were found. Next release on example will detect buildpack normally.') - .it('# with no buildpacks reports an error removing buildpack_url') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + }) + .command(['buildpacks:remove', 'https://github.com/bar/bar', '-a', 'example']) + .catch('No buildpacks were found. Next release on example will detect buildpack normally.') + .it('# with no buildpacks reports an error removing buildpack_url') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/foo/foo', - ]) - }) - .command(['buildpacks:remove', 'https://github.com/bar/bar', '-a', 'example']) - .catch('Buildpack not found. Nothing was removed.') - .it('# returns an error when the url is not found') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/foo/foo', + ]) + }) + .command(['buildpacks:remove', 'https://github.com/bar/bar', '-a', 'example']) + .catch('Buildpack not found. Nothing was removed.') + .it('# returns an error when the url is not found') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs' - ]) - }) - .stdout() - .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with three buildpacks successfully removes url', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack removed. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + }) + .stdout() + .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with three buildpacks successfully removes url', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack removed. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-nodejs Run git push heroku master to create a new release using these buildpacks. `) - }) + }) }) describe('-i INDEX URL', () => { test - .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .catch('Please choose either index or Buildpack, but not both.') - .it('# returns an error message when i and url are specified') + .command(['buildpacks:remove', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .catch('Please choose either index or Buildpack, but not both.') + .it('# returns an error message when i and url are specified') test - .command(['buildpacks:remove', '-a', 'example']) - .catch('Usage: heroku buildpacks:remove [BUILDPACK_URL]. Must specify a buildpack to remove, either by index or URL.') - .it('# returns an error message neither i or url are specified') + .command(['buildpacks:remove', '-a', 'example']) + .catch('Usage: heroku buildpacks:remove [BUILDPACK_URL]. Must specify a buildpack to remove, either by index or URL.') + .it('# returns an error message neither i or url are specified') }) }) diff --git a/packages/buildpacks/test/commands/buildpacks/search.test.ts b/packages/buildpacks/test/commands/buildpacks/search.test.ts index 1824d09b85..80d31796ba 100644 --- a/packages/buildpacks/test/commands/buildpacks/search.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/search.test.ts @@ -2,48 +2,47 @@ import Nock from '@fancy-test/nock' import {Fixture} from '@heroku/buildpack-registry' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' + nock.disableNetConnect() const test = otest.register('nock', Nock) describe('buildpacks:search', () => { test - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks?in[namespace][]=heroku') - .reply(200, [ - Fixture.buildpack({ - name: 'ruby', - description: 'Official Heroku Buildpack for Ruby', - }) - ]) - }) - .stdout() - .command(['buildpacks:search', '--namespace', 'heroku']) - .it('searches using the namespace', ctx => { - expect(ctx.stdout).to.contain('heroku/ruby') - expect(ctx.stdout).to.contain('1 buildpack found') - }) - - test - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - let rubyBuildpack = Fixture.buildpack({ + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks?in[namespace][]=heroku') + .reply(200, [ + Fixture.buildpack({ name: 'ruby', - description: 'Official Heroku Buildpack for Ruby' - }) + description: 'Official Heroku Buildpack for Ruby', + }), + ]) + }) + .stdout() + .command(['buildpacks:search', '--namespace', 'heroku']) + .it('searches using the namespace', ctx => { + expect(ctx.stdout).to.contain('heroku/ruby') + expect(ctx.stdout).to.contain('1 buildpack found') + }) - api - .get('/buildpacks?in[namespace][]=ruby') - .reply(200, []) - .get('/buildpacks?in[name][]=ruby') - .reply(200, [rubyBuildpack]) - .get('/buildpacks?like[description]=ruby') - .reply(200, [rubyBuildpack]) - }) - .stdout() - .command(['buildpacks:search', 'ruby']) - .it('searches only returns unique buildpacks', ctx => { - expect(ctx.stdout).to.contain('1 buildpack found') + test + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + const rubyBuildpack = Fixture.buildpack({ + name: 'ruby', + description: 'Official Heroku Buildpack for Ruby', }) + + api + .get('/buildpacks?in[namespace][]=ruby') + .reply(200, []) + .get('/buildpacks?in[name][]=ruby') + .reply(200, [rubyBuildpack]) + .get('/buildpacks?like[description]=ruby') + .reply(200, [rubyBuildpack]) + }) + .stdout() + .command(['buildpacks:search', 'ruby']) + .it('searches only returns unique buildpacks', ctx => { + expect(ctx.stdout).to.contain('1 buildpack found') + }) }) diff --git a/packages/buildpacks/test/commands/buildpacks/set.test.ts b/packages/buildpacks/test/commands/buildpacks/set.test.ts index b3a6aa3574..4a094773b1 100644 --- a/packages/buildpacks/test/commands/buildpacks/set.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/set.test.ts @@ -1,229 +1,227 @@ import Nock from '@fancy-test/nock' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' -nock.disableNetConnect() -const test = otest.register('nock', Nock) import {BuildpackInstallationsStub as Stubber} from '../../helpers/buildpack-installations-stub' +nock.disableNetConnect() +const test = otest.register('nock', Nock) describe('buildpacks:set', () => { describe('URL', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby' - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) - .it('# with no buildpacks sets the buildpack URL', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-a', 'example']) + .it('# with no buildpacks sets the buildpack URL', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/foobar/foobar', - ]) - }) - .command(['buildpacks:set', 'https://github.com/foobar/foobar', '-a', 'example']) - .catch('The buildpack https://github.com/foobar/foobar is already set on your app.') - .it('# errors out when already exists') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/foobar/foobar', + ]) + }) + .command(['buildpacks:set', 'https://github.com/foobar/foobar', '-a', 'example']) + .catch('The buildpack https://github.com/foobar/foobar is already set on your app.') + .it('# errors out when already exists') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/foo/foo', - 'https://github.com/baz/baz', - 'https://github.com/biz/biz', - ]) - Stubber.put(api, [ - 'https://github.com/bar/bar', - 'https://github.com/baz/baz', - 'https://github.com/biz/biz', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/bar/bar', '-a', 'example']) - .it('# overwrites in the the first when no i is passed', ctx => { - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/foo/foo', + 'https://github.com/baz/baz', + 'https://github.com/biz/biz', + ]) + Stubber.put(api, [ + 'https://github.com/bar/bar', + 'https://github.com/baz/baz', + 'https://github.com/biz/biz', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/bar/bar', '-a', 'example']) + .it('# overwrites in the the first when no i is passed', ctx => { + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use: 1. https://github.com/bar/bar 2. https://github.com/baz/baz 3. https://github.com/biz/biz Run git push heroku master to create a new release using these buildpacks. `) - }) + }) }) describe('-i INDEX URL', () => { test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .it('# with no buildpacks sets the buildpack URL with index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .it('# with no buildpacks sets the buildpack URL with index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .it('# with one existing buildpack successfully overwrites an existing buildpack URL at index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .it('# with one existing buildpack successfully overwrites an existing buildpack URL at index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use https://github.com/heroku/heroku-buildpack-ruby. Run git push heroku master to create a new release using this buildpack. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .catch('The buildpack https://github.com/heroku/heroku-buildpack-ruby is already set on your app.') - .it('# with one existing buildpack unsuccessfully fails if buildpack is already set') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .catch('The buildpack https://github.com/heroku/heroku-buildpack-ruby is already set on your app.') + .it('# with one existing buildpack unsuccessfully fails if buildpack is already set') test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-ruby', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) - .it('# with two existing buildpacks successfully overwrites an existing buildpack URL at index', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-ruby', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '1', '-a', 'example']) + .it('# with two existing buildpacks successfully overwrites an existing buildpack URL at index', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-ruby 2. https://github.com/heroku/heroku-buildpack-nodejs Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '3', '-a', 'example']) - .it('# with two existing buildpacks successfully adds buildpack URL to the end of list', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '3', '-a', 'example']) + .it('# with two existing buildpacks successfully adds buildpack URL to the end of list', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-nodejs 3. https://github.com/heroku/heroku-buildpack-ruby Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - Stubber.put(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - 'https://github.com/heroku/heroku-buildpack-ruby', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '99', '-a', 'example']) - .it('# with two existing buildpacks successfully adds buildpack URL to the very end of list', ctx => { - expect(ctx.stderr).to.equal('') - expect(ctx.stdout).to.equal( - `Buildpack set. Next release on example will use: + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + Stubber.put(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + 'https://github.com/heroku/heroku-buildpack-ruby', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-ruby', '-i', '99', '-a', 'example']) + .it('# with two existing buildpacks successfully adds buildpack URL to the very end of list', ctx => { + expect(ctx.stderr).to.equal('') + expect(ctx.stdout).to.equal( + `Buildpack set. Next release on example will use: 1. https://github.com/heroku/heroku-buildpack-java 2. https://github.com/heroku/heroku-buildpack-nodejs 3. https://github.com/heroku/heroku-buildpack-ruby Run git push heroku master to create a new release using these buildpacks. `) - }) + }) test - .nock('https://api.heroku.com', (api: Scope) => { - Stubber.get(api, [ - 'https://github.com/heroku/heroku-buildpack-java', - 'https://github.com/heroku/heroku-buildpack-nodejs', - ]) - }) - .stdout() - .stderr() - .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-java', '-i', '2', '-a', 'example']) - .catch('The buildpack https://github.com/heroku/heroku-buildpack-java is already set on your app.') - .it('# with two existing buildpacks unsuccessfully fails if buildpack is already set') + .nock('https://api.heroku.com', (api: nock.Scope) => { + Stubber.get(api, [ + 'https://github.com/heroku/heroku-buildpack-java', + 'https://github.com/heroku/heroku-buildpack-nodejs', + ]) + }) + .stdout() + .stderr() + .command(['buildpacks:set', 'https://github.com/heroku/heroku-buildpack-java', '-i', '2', '-a', 'example']) + .catch('The buildpack https://github.com/heroku/heroku-buildpack-java is already set on your app.') + .it('# with two existing buildpacks unsuccessfully fails if buildpack is already set') test - .command(['buildpacks:set', 'https://github.com/bar/bar', '-i', 'notaninteger', '-a', 'example']) - .catch('Expected an integer but received: notaninteger') - .it('# returns an error message when i is not an integer') + .command(['buildpacks:set', 'https://github.com/bar/bar', '-i', 'notaninteger', '-a', 'example']) + .catch('Expected an integer but received: notaninteger') + .it('# returns an error message when i is not an integer') test - .command(['buildpacks:set', 'https://github.com/bar/bar', '-i', '-1', '-a', 'example']) - .catch('Invalid index. Must be greater than 0.') - .it('# returns an error message when i < 0') + .command(['buildpacks:set', 'https://github.com/bar/bar', '-i', '-1', '-a', 'example']) + .catch('Invalid index. Must be greater than 0.') + .it('# returns an error message when i < 0') test - .command(['buildpacks:set', '-a', 'example']) - .catch(`Missing 1 required arg: + .command(['buildpacks:set', '-a', 'example']) + .catch(`Missing 1 required arg: buildpack namespace/name of the buildpack See more help with --help`) - .it('# handles a missing buildpack URL arg') + .it('# handles a missing buildpack URL arg') }) }) // // // -//}) +// }) diff --git a/packages/buildpacks/test/commands/buildpacks/versions.test.ts b/packages/buildpacks/test/commands/buildpacks/versions.test.ts index e6fa8e56df..5b9db00372 100644 --- a/packages/buildpacks/test/commands/buildpacks/versions.test.ts +++ b/packages/buildpacks/test/commands/buildpacks/versions.test.ts @@ -2,48 +2,47 @@ import Nock from '@fancy-test/nock' import {Fixture} from '@heroku/buildpack-registry' import {expect, test as otest} from '@oclif/test' import * as nock from 'nock' -// tslint:disable-next-line:no-duplicate-imports -import {Scope} from 'nock' + nock.disableNetConnect() const test = otest.register('nock', Nock) describe('buildpacks:versions', () => { test - .env({HEROKU_API_KEY: 'authtoken'}) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/heroku%2Fruby/revisions') - .reply(200, [ - Fixture.revision({ - release: 138, - }) - ]) - }) - .stdout() - .command(['buildpacks:versions', 'heroku/ruby']) - .it('shows info about the buildpack', ctx => { - expect(ctx.stdout).to.contain('138') - }) + .env({HEROKU_API_KEY: 'authtoken'}) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/heroku%2Fruby/revisions') + .reply(200, [ + Fixture.revision({ + release: 138, + }), + ]) + }) + .stdout() + .command(['buildpacks:versions', 'heroku/ruby']) + .it('shows info about the buildpack', ctx => { + expect(ctx.stdout).to.contain('138') + }) test - .env({HEROKU_API_KEY: 'authtoken'}) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/hone%2Ftest/revisions') - .reply(404, '') - }) - .command(['buildpacks:versions', 'hone/test']) - .catch("Could not find 'hone/test'") - .it('handles buildpack not existing') + .env({HEROKU_API_KEY: 'authtoken'}) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/hone%2Ftest/revisions') + .reply(404, '') + }) + .command(['buildpacks:versions', 'hone/test']) + .catch("Could not find 'hone/test'") + .it('handles buildpack not existing') test - .env({HEROKU_API_KEY: 'authtoken'}) - .nock('https://buildpack-registry.heroku.com', (api: Scope) => { - api - .get('/buildpacks/hone%2Ftest/revisions') - .reply(500, 'some error') - }) - .command(['buildpacks:versions', 'hone/test']) - .catch('Problem fetching versions, 500: some error') - .it('handles server error') + .env({HEROKU_API_KEY: 'authtoken'}) + .nock('https://buildpack-registry.heroku.com', (api: nock.Scope) => { + api + .get('/buildpacks/hone%2Ftest/revisions') + .reply(500, 'some error') + }) + .command(['buildpacks:versions', 'hone/test']) + .catch('Problem fetching versions, 500: some error') + .it('handles server error') }) diff --git a/packages/buildpacks/test/helpers/buildpack-installations-stub.ts b/packages/buildpacks/test/helpers/buildpack-installations-stub.ts index a6b0886bd7..f00803e506 100644 --- a/packages/buildpacks/test/helpers/buildpack-installations-stub.ts +++ b/packages/buildpacks/test/helpers/buildpack-installations-stub.ts @@ -1,11 +1,12 @@ +/* eslint-disable no-inner-declarations */ import {Scope} from 'nock' export namespace BuildpackInstallationsStub { - export function get(nock: Scope, buildpacks?: Array) { + export function get(nock: Scope, buildpacks?: Array) { let response: any if (buildpacks && buildpacks.length > 0) { - if (typeof(buildpacks[0]) === 'string') { + if (typeof (buildpacks[0]) === 'string') { response = buildpacks.map((b, i) => { return { buildpack: {url: b}, @@ -25,18 +26,18 @@ export namespace BuildpackInstallationsStub { } nock - .get('/apps/example/buildpack-installations') - .reply(200, response) + .get('/apps/example/buildpack-installations') + .reply(200, response) } - export function put(nock: Scope, buildpacks?: Array, registry?: Map) { + export function put(nock: Scope, buildpacks?: Array, registry?: Map) { let updates: Array<{buildpack: string}> = [] let response: Array<{ buildpack: { - url: string, - name?: string, - }, - ordinal: number, + url: string; + name?: string; + }; + ordinal: number; }> = [] if (buildpacks) { @@ -44,7 +45,7 @@ export namespace BuildpackInstallationsStub { return {buildpack: b} }) response = buildpacks.map((b, index) => { - let buildpack: {url: string, name?: string} = {url: b} + let buildpack: {url: string; name?: string} = {url: b} if (registry) { buildpack = registry.get(b) || {url: b} @@ -55,7 +56,7 @@ export namespace BuildpackInstallationsStub { } nock - .put('/apps/example/buildpack-installations', {updates}) - .reply(200, response) + .put('/apps/example/buildpack-installations', {updates}) + .reply(200, response) } } diff --git a/packages/buildpacks/tslint.json b/packages/buildpacks/tslint.json deleted file mode 100644 index f5703540c9..0000000000 --- a/packages/buildpacks/tslint.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "@oclif/tslint" -} diff --git a/packages/cli/test/mocha.opts b/packages/cli/test/mocha.opts index 04c0bd3e0e..403209f1d6 100644 --- a/packages/cli/test/mocha.opts +++ b/packages/cli/test/mocha.opts @@ -4,4 +4,4 @@ --watch-extensions ts --recursive --reporter spec ---timeout 50000 +--timeout 60000 diff --git a/yarn.lock b/yarn.lock index a45731a547..b60d5df924 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1835,39 +1835,39 @@ "@types/node" "*" "@typescript-eslint/eslint-plugin@^2.6.1": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.11.0.tgz#4477c33491ccf0a9a3f4a30ef84978fa0ea0cad2" - integrity sha512-G2HHA1vpMN0EEbUuWubiCCfd0R3a30BB+UdvnFkxwZIxYEGOrWEXDv8tBFO9f44CWc47Xv9lLM3VSn4ORLI2bA== + version "2.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/eslint-plugin/-/eslint-plugin-2.12.0.tgz#0da7cbca7b24f4c6919e9eb31c704bfb126f90ad" + integrity sha512-1t4r9rpLuEwl3hgt90jY18wJHSyb0E3orVL3DaqwmpiSDHmHiSspVsvsFF78BJ/3NNG3qmeso836jpuBWYziAA== dependencies: - "@typescript-eslint/experimental-utils" "2.11.0" + "@typescript-eslint/experimental-utils" "2.12.0" eslint-utils "^1.4.3" functional-red-black-tree "^1.0.1" regexpp "^3.0.0" tsutils "^3.17.1" -"@typescript-eslint/experimental-utils@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.11.0.tgz#cef18e6b122706c65248a5d8984a9779ed1e52ac" - integrity sha512-YxcA/y0ZJaCc/fB/MClhcDxHI0nOBB7v2/WxBju2cOTanX7jO9ttQq6Fy4yW9UaY5bPd9xL3cun3lDVqk67sPQ== +"@typescript-eslint/experimental-utils@2.12.0": + version "2.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/experimental-utils/-/experimental-utils-2.12.0.tgz#e0a76ffb6293e058748408a191921e453c31d40d" + integrity sha512-jv4gYpw5N5BrWF3ntROvCuLe1IjRenLy5+U57J24NbPGwZFAjhnM45qpq0nDH1y/AZMb3Br25YiNVwyPbz6RkA== dependencies: "@types/json-schema" "^7.0.3" - "@typescript-eslint/typescript-estree" "2.11.0" + "@typescript-eslint/typescript-estree" "2.12.0" eslint-scope "^5.0.0" "@typescript-eslint/parser@^2.6.1": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.11.0.tgz#cdcc3be73ee31cbef089af5ff97ccaa380ef6e8b" - integrity sha512-DyGXeqhb3moMioEFZIHIp7oXBBh7dEfPTzGrlyP0Mi9ScCra4SWEGs3kPd18mG7Sy9Wy8z88zmrw5tSGL6r/6A== + version "2.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/parser/-/parser-2.12.0.tgz#393f1604943a4ca570bb1a45bc8834e9b9158884" + integrity sha512-lPdkwpdzxEfjI8TyTzZqPatkrswLSVu4bqUgnB03fHSOwpC7KSerPgJRgIAf11UGNf7HKjJV6oaPZI4AghLU6g== dependencies: "@types/eslint-visitor-keys" "^1.0.0" - "@typescript-eslint/experimental-utils" "2.11.0" - "@typescript-eslint/typescript-estree" "2.11.0" + "@typescript-eslint/experimental-utils" "2.12.0" + "@typescript-eslint/typescript-estree" "2.12.0" eslint-visitor-keys "^1.1.0" -"@typescript-eslint/typescript-estree@2.11.0": - version "2.11.0" - resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.11.0.tgz#21ada6504274cd1644855926312c798fc697e9fb" - integrity sha512-HGY4+d4MagO6cKMcKfIKaTMxcAv7dEVnji2Zi+vi5VV8uWAM631KjAB5GxFcexMYrwKT0EekRiiGK1/Sd7VFGA== +"@typescript-eslint/typescript-estree@2.12.0": + version "2.12.0" + resolved "https://registry.yarnpkg.com/@typescript-eslint/typescript-estree/-/typescript-estree-2.12.0.tgz#bd9e547ccffd17dfab0c3ab0947c80c8e2eb914c" + integrity sha512-rGehVfjHEn8Frh9UW02ZZIfJs6SIIxIu/K1bbci8rFfDE/1lQ8krIJy5OXOV3DVnNdDPtoiPOdEANkLMrwXbiQ== dependencies: debug "^4.1.1" eslint-visitor-keys "^1.1.0"