basic PR feedback.

This commit is contained in:
Paul Irish 2017-06-16 15:19:45 -07:00
parent d1fd269d2c
commit 4e1df03d96
3 changed files with 24 additions and 18 deletions

View file

@ -142,6 +142,11 @@ from which this plugin was forked.
Please provide examples of the URLs you are parsing with each PR.
You can run `git-open` in `echo` mode, which doesn't open your browser, but just prints the URL to stdout:
```sh
BATS_CWD="." ./git-open
```
#### Testing:
You'll need to install [bats](https://github.com/sstephenson/bats#installing-bats-from-source), the Bash automated testing system. It's also available as `brew install bats`
@ -154,7 +159,7 @@ bats test
# Run it on every change with `entr`
brew install entr
ls --color=never * test/*.bats | entr bats test
npm run watch
```
## Related projects

View file

@ -34,7 +34,8 @@
"lint:editorconfig": "eclint check git-open* readme* .travis.yml",
"lint:package": "pjv --recommendations --warnings",
"lint:readme": "node ./node_modules/markdownlint/lib/markdownlint.js --config markdownlint.json README.md",
"test": "npm run lint:package && npm run lint:readme && npm run lint:editorconfig"
"test": "npm run lint:package && npm run lint:readme && npm run lint:editorconfig",
"watch": "find . -maxdepth 2 -iname '*bats' -o -iname 'git-open' | entr bats test/"
},
"dependencies": {},
"devDependencies": {

View file

@ -14,21 +14,21 @@ setup() {
## GitHub
##
@test "gh basic" {
@test "gh: basic" {
git remote set-url origin "git@github.com:user/repo.git"
git checkout -B "master"
run ../git-open
assert_output "https://github.com/user/repo/"
}
@test "gh branch" {
@test "gh: branch" {
git remote set-url origin "git@github.com:user/repo.git"
git checkout -B "mybranch"
run ../git-open
assert_output "https://github.com/user/repo/tree/mybranch"
}
@test "gh non-origin remote" {
@test "gh: non-origin remote" {
git remote set-url origin "git@github.com:user/repo.git"
git remote add upstream "git@github.com:upstreamorg/repo.git"
run ../git-open "upstream"
@ -39,14 +39,14 @@ setup() {
assert_output "https://github.com/upstreamorg/repo/tree/otherbranch"
}
@test "gh without git user" {
@test "gh: without git user" {
# https://github.com/paulirish/git-open/pull/63
git remote set-url origin "github.com:paulirish/git-open.git"
run ../git-open
assert_output "https://github.com/paulirish/git-open/"
}
@test "gh ssh origin" {
@test "gh: ssh origin" {
git remote set-url origin "ssh://git@github.com/user/repo"
run ../git-open
assert_output "https://github.com/user/repo/"
@ -65,13 +65,13 @@ setup() {
assert_output "https://github.com/paulirish/git-open/issues/12"
}
@test "gh gist" {
@test "gh: gist" {
git remote set-url origin "git@gist.github.com:2d84a6db1b41b4020685.git"
run ../git-open
assert_output "https://gist.github.com/2d84a6db1b41b4020685/"
}
@test "# and % in branch names are URL encoded" {
@test "basic: # and % in branch names are URL encoded" {
# https://github.com/paulirish/git-open/pull/24
git checkout -B "issue-#42"
run ../git-open
@ -88,13 +88,13 @@ setup() {
## Bitbucket
##
@test "bitbucket basic" {
@test "bitbucket: basic" {
git remote set-url origin "git@bitbucket.org:paulirish/crbug-extension.git"
run ../git-open
assert_output --partial "https://bitbucket.org/paulirish/crbug-extension/"
}
@test "bitbucket non-origin remote" {
@test "bitbucket: non-origin remote" {
# https://github.com/paulirish/git-open/pull/4
git remote add bbclone "git@bitbucket.org:rwhitbeck/git-open.git"
run ../git-open "bbclone"
@ -102,7 +102,7 @@ setup() {
assert_output --partial "//?at=master"
}
@test "bitbucket branch" {
@test "bitbucket: branch" {
git remote set-url origin "https://paulirish@bitbucket.org/malb/lwe-estimator.git"
git checkout -B "new-bkw"
run ../git-open
@ -110,7 +110,7 @@ setup() {
assert_output --partial "?at=new-bkw"
}
@test "bitbucket ssh:// clone urls" {
@test "bitbucket: ssh:// clone urls" {
# https://github.com/paulirish/git-open/pull/36
git remote set-url origin "ssh://git@bitbucket.org/lbesson/bin.git"
run ../git-open
@ -118,7 +118,7 @@ setup() {
assert_output --partial "//?at=master"
}
@test "no username@bitbucket.org in final url" {
@test "bitbucket: no username@ in final url" {
# https://github.com/paulirish/git-open/pull/69
git remote set-url origin "https://trend_rand@bitbucket.org/trend_rand/test-repo.git"
run ../git-open
@ -130,7 +130,7 @@ setup() {
## GitLab
##
@test "gitlab seperate domains" {
@test "gitlab: separate domains" {
# https://github.com/paulirish/git-open/pull/56
git remote set-url origin "git@git.example.com:namespace/project.git"
git config "gitopen.gitlab.domain" "gitlab.example.com"
@ -139,7 +139,7 @@ setup() {
assert_output "https://gitlab.example.com/namespace/project/"
}
@test "gitlab default ssh origin style" {
@test "gitlab: default ssh origin style" {
# https://github.com/paulirish/git-open/pull/55
git remote set-url origin "git@gitlab.example.com:user/repo"
git config "gitopen.gitlab.domain" "gitlab.example.com"
@ -147,7 +147,7 @@ setup() {
assert_output "https://gitlab.example.com/user/repo/"
}
@test "gitlab ssh:// origin style" {
@test "gitlab: ssh:// origin style" {
# https://github.com/paulirish/git-open/pull/51
git remote set-url origin "ssh://git@gitlab.domain.com/user/repo"
git config "gitopen.gitlab.domain" "gitlab.domain.com"
@ -167,7 +167,7 @@ teardown() {
rm -rf "$foldername"
}
# helper to create a test git sandbox that won"t dirty the real repo
# helper to create a test git sandbox that won't dirty the real repo
function create_git_sandbox() {
rm -rf "$foldername"
mkdir "$foldername"