-
Notifications
You must be signed in to change notification settings - Fork 207
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1082 from intuit/updated-title-bug
Respect Updated PR Titles
- Loading branch information
Showing
109 changed files
with
5,846 additions
and
5,777 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
export default [ | ||
'dependabot-preview[bot]', | ||
'greenkeeper[bot]', | ||
'dependabot[bot]', | ||
'fossabot', | ||
'renovate', | ||
'renovate-bot', | ||
'renovate[bot]', | ||
'renovate-approve' | ||
"dependabot-preview[bot]", | ||
"greenkeeper[bot]", | ||
"dependabot[bot]", | ||
"fossabot", | ||
"renovate", | ||
"renovate-bot", | ||
"renovate[bot]", | ||
"renovate-approve", | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,87 +1,87 @@ | ||
import parseArgs from '../src/parse-args'; | ||
import parseArgs from "../src/parse-args"; | ||
|
||
const log = jest.fn(); | ||
// @ts-ignore | ||
global.console = { log }; | ||
|
||
describe('root parser', () => { | ||
describe("root parser", () => { | ||
beforeEach(() => { | ||
log.mockClear(); | ||
}); | ||
|
||
test('should print version', () => { | ||
parseArgs('--version'.split(' ')); | ||
test("should print version", () => { | ||
parseArgs("--version".split(" ")); | ||
expect(log).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should print help', () => { | ||
parseArgs('--help'.split(' ')); | ||
test("should print help", () => { | ||
parseArgs("--help".split(" ")); | ||
expect(log).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should print help for simple command', () => { | ||
parseArgs('init --help'.split(' ')); | ||
test("should print help for simple command", () => { | ||
parseArgs("init --help".split(" ")); | ||
expect(log).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should print help for complex command', () => { | ||
parseArgs('pr-status --help'.split(' ')); | ||
test("should print help for complex command", () => { | ||
parseArgs("pr-status --help".split(" ")); | ||
expect(log).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should exit when required arg is not included', () => { | ||
test("should exit when required arg is not included", () => { | ||
process.exit = jest.fn() as any; | ||
parseArgs(['pr-status']); | ||
parseArgs(["pr-status"]); | ||
expect(process.exit).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should exit when required string is provided as flag', () => { | ||
test("should exit when required string is provided as flag", () => { | ||
process.exit = jest.fn() as any; | ||
parseArgs(['pr-check', '--pr', '24', '--url']); | ||
parseArgs(["pr-check", "--pr", "24", "--url"]); | ||
expect(process.exit).toHaveBeenCalled(); | ||
}); | ||
|
||
test('should parse just provided args', () => { | ||
expect(parseArgs('label --pr 2 --owner adam'.split(' '))).toStrictEqual([ | ||
'label', | ||
test("should parse just provided args", () => { | ||
expect(parseArgs("label --pr 2 --owner adam".split(" "))).toStrictEqual([ | ||
"label", | ||
expect.objectContaining({ | ||
pr: 2, | ||
owner: 'adam' | ||
}) | ||
owner: "adam", | ||
}), | ||
]); | ||
}); | ||
|
||
test('should parse args as camelCase', () => { | ||
expect(parseArgs('changelog -d'.split(' '))).toStrictEqual([ | ||
'changelog', | ||
test("should parse args as camelCase", () => { | ||
expect(parseArgs("changelog -d".split(" "))).toStrictEqual([ | ||
"changelog", | ||
expect.objectContaining({ | ||
dryRun: true | ||
}) | ||
dryRun: true, | ||
}), | ||
]); | ||
}); | ||
|
||
test('error when on in array of options to is not present', () => { | ||
test("error when on in array of options to is not present", () => { | ||
process.exit = jest.fn() as any; | ||
parseArgs(['comment']); | ||
parseArgs(["comment"]); | ||
expect(process.exit).toHaveBeenCalled(); | ||
}); | ||
|
||
test('allow array of options to or', () => { | ||
expect(parseArgs(['comment', '--message', 'foo'])).toStrictEqual([ | ||
'comment', | ||
test("allow array of options to or", () => { | ||
expect(parseArgs(["comment", "--message", "foo"])).toStrictEqual([ | ||
"comment", | ||
expect.objectContaining({ | ||
message: 'foo' | ||
}) | ||
message: "foo", | ||
}), | ||
]); | ||
}); | ||
|
||
test('allow edit in comment', () => { | ||
expect(parseArgs(['comment', '--edit', '--message', 'foo'])).toStrictEqual([ | ||
'comment', | ||
test("allow edit in comment", () => { | ||
expect(parseArgs(["comment", "--edit", "--message", "foo"])).toStrictEqual([ | ||
"comment", | ||
expect.objectContaining({ | ||
edit: true, | ||
message: 'foo' | ||
}) | ||
message: "foo", | ||
}), | ||
]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import main, { run } from '../src/run'; | ||
import main, { run } from "../src/run"; | ||
|
||
process.env.GH_TOKEN = 'XXXX'; | ||
process.env.GH_TOKEN = "XXXX"; | ||
|
||
test('throws error for unknown args', async () => { | ||
test("throws error for unknown args", async () => { | ||
process.exit = jest.fn() as any; | ||
console.log = jest.fn() as any; | ||
|
||
await run('foo', {}); | ||
await run("foo", {}); | ||
|
||
expect(process.exit).toHaveBeenCalledWith(1); | ||
}); | ||
|
||
test('throws exits for caught error', async () => { | ||
test("throws exits for caught error", async () => { | ||
console.log = jest.fn() as any; | ||
process.exit = jest.fn() as any; | ||
|
||
await main('foo', {}); | ||
await main("foo", {}); | ||
|
||
expect(process.exit).toHaveBeenCalledWith(1); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,36 +1,36 @@ | ||
#!/usr/bin/env node | ||
|
||
import moduleAlias from 'module-alias'; | ||
import path from 'path'; | ||
import moduleAlias from "module-alias"; | ||
import path from "path"; | ||
|
||
try { | ||
// eslint-disable-next-line | ||
const json = require(path.join(__dirname, '../../package.json')); | ||
const json = require(path.join(__dirname, "../../package.json")); | ||
|
||
if (json.name.startsWith('@auto-canary')) { | ||
if (json.name.startsWith("@auto-canary")) { | ||
moduleAlias.addAliases({ | ||
'@auto-it': (fromPath: string, request: string) => | ||
"@auto-it": (fromPath: string, request: string) => | ||
// We want to rewrite all the imports for canary (ex: npm plugin requiring core) | ||
request.startsWith('@auto-it') && | ||
request.startsWith("@auto-it") && | ||
// but we also want to be able to require official plugins from a canary | ||
!fromPath.endsWith('noop.js') && | ||
!fromPath.endsWith("noop.js") && | ||
// and don't want to override those plugins's imports | ||
!fromPath.includes('@auto-it') | ||
? '@auto-canary' | ||
: '@auto-it' | ||
!fromPath.includes("@auto-it") | ||
? "@auto-canary" | ||
: "@auto-it", | ||
}); | ||
} | ||
} catch (error) {} | ||
|
||
import chalk from 'chalk'; | ||
import parseArgs from '../parse-args'; | ||
import run from '../run'; | ||
import chalk from "chalk"; | ||
import parseArgs from "../parse-args"; | ||
import run from "../run"; | ||
|
||
const [command, args] = parseArgs(); | ||
|
||
if (command && args) { | ||
run(command, args).catch((e: Error) => { | ||
console.error(chalk.redBright('Error: '), e.message); | ||
console.error(chalk.redBright("Error: "), e.message); | ||
process.exit(1); | ||
}); | ||
} |
Oops, something went wrong.