learn-test 3.1.1 → 3.2.1.pre.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -0
- data/Gemfile +2 -12
- data/Rakefile +2 -1
- data/bin/learn-test +15 -14
- data/bin/learn-test-wip +356 -0
- data/learn-test.gemspec +20 -8
- data/lib/learn_test.rb +3 -0
- data/lib/learn_test/client.rb +2 -0
- data/lib/learn_test/dependencies/ant.rb +2 -0
- data/lib/learn_test/dependencies/csharp.rb +3 -1
- data/lib/learn_test/dependencies/imagemagick.rb +2 -0
- data/lib/learn_test/dependencies/java.rb +2 -0
- data/lib/learn_test/dependencies/karma.rb +2 -0
- data/lib/learn_test/dependencies/nodejs.rb +2 -0
- data/lib/learn_test/dependencies/phantomjs.rb +6 -4
- data/lib/learn_test/dependencies/protractor.rb +2 -0
- data/lib/learn_test/dependencies/selenium_server.rb +2 -0
- data/lib/learn_test/dependency.rb +4 -4
- data/lib/learn_test/file_finder.rb +2 -1
- data/lib/learn_test/git_wip.rb +23 -0
- data/lib/learn_test/github_interactor.rb +2 -1
- data/lib/learn_test/js_strategy.rb +3 -1
- data/lib/learn_test/learn_oauth_token_parser.rb +2 -0
- data/lib/learn_test/netrc_interactor.rb +2 -1
- data/lib/learn_test/repo_parser.rb +2 -0
- data/lib/learn_test/reporter.rb +14 -7
- data/lib/learn_test/runner.rb +5 -3
- data/lib/learn_test/strategies/csharp_nunit.rb +5 -3
- data/lib/learn_test/strategies/java_junit.rb +9 -8
- data/lib/learn_test/strategies/karma.rb +9 -5
- data/lib/learn_test/strategies/mocha.rb +10 -8
- data/lib/learn_test/strategies/protractor.rb +7 -6
- data/lib/learn_test/strategies/pytest.rb +13 -13
- data/lib/learn_test/strategies/pytest/requirements_checker.rb +14 -12
- data/lib/learn_test/strategies/rspec.rb +11 -10
- data/lib/learn_test/strategy.rb +5 -6
- data/lib/learn_test/user_id_parser.rb +2 -1
- data/lib/learn_test/username_parser.rb +3 -2
- data/lib/learn_test/version.rb +3 -1
- data/spec/features/rspec_unit_spec.rb +4 -2
- data/spec/fixtures/rspec-unit-spec/lib/dog.rb +3 -1
- data/spec/fixtures/rspec-unit-spec/spec/dog_spec.rb +4 -2
- data/spec/fixtures/rspec-unit-spec/spec/spec_helper.rb +2 -0
- data/spec/learn_test/git_spec.rb +40 -0
- data/spec/learn_test/reporter_spec.rb +69 -31
- data/spec/learn_test/username_parser_spec.rb +2 -0
- data/spec/lib/learn_test/strategies/mocha_spec.rb +21 -20
- data/spec/repo_parser_spec.rb +14 -12
- data/spec/spec_helper.rb +2 -0
- metadata +136 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 85948be08314d36e3b4597876f067163c9025b10f942206017ff52ea41bc523e
|
4
|
+
data.tar.gz: 865fceee285410a3379ccae13fd4de8ca88500987b696235217d91d0148ae560
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '09a99a7add2f3e8e801d56bd5b6c000dd55bed72bcfd69c31d5579c8cfb2d45f07b381d29433cf0a2d994f08ffc77c5321a2702daf910b00da50f5753eed9667'
|
7
|
+
data.tar.gz: f20bcc537d9c2809681821a8a938bb8dae4913e07148927410802be2aaf7153628e6e3f58da8fa01ebcc61abb139795f3439e8a642fae4015aa01fa2149b4e76
|
data/.rspec
CHANGED
data/Gemfile
CHANGED
@@ -1,16 +1,6 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
gem 'rspec', '~> 3.7'
|
4
|
-
gem 'netrc', '~> 0.11.0'
|
5
|
-
gem 'git', '~> 1.7'
|
6
|
-
gem 'oj', '~> 3.10'
|
7
|
-
gem 'faraday', '~> 1.0'
|
8
|
-
gem 'crack', '~> 0.4.3'
|
9
|
-
gem 'colorize', '~> 0.8.1'
|
1
|
+
# frozen_string_literal: true
|
10
2
|
|
11
|
-
|
12
|
-
gem 'rake', '~> 13.0.1'
|
13
|
-
end
|
3
|
+
source 'https://rubygems.org'
|
14
4
|
|
15
5
|
group :test do
|
16
6
|
gem 'rspec_junit_formatter', '~> 0.4.1'
|
data/Rakefile
CHANGED
data/bin/learn-test
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
2
3
|
|
3
4
|
require 'optparse'
|
4
5
|
require_relative '../lib/learn_test'
|
@@ -6,45 +7,45 @@ require_relative '../lib/learn_test'
|
|
6
7
|
options = {}
|
7
8
|
|
8
9
|
OptionParser.new do |opts|
|
9
|
-
opts.banner =
|
10
|
+
opts.banner = 'Usage: learn [options]'
|
10
11
|
|
11
|
-
opts.on(
|
12
|
+
opts.on('--sync', 'Report test results synchronously') do |s|
|
12
13
|
options[:sync] = s
|
13
14
|
end
|
14
15
|
|
15
|
-
opts.on(
|
16
|
+
opts.on('-d', '--debug', 'Output errors during results synchronization') do |d|
|
16
17
|
options[:debug] = d
|
17
18
|
end
|
18
19
|
|
19
|
-
opts.on(
|
20
|
+
opts.on('-n', '--[no-]color', 'Turn off color output') do |c|
|
20
21
|
options[:color] = c
|
21
22
|
end
|
22
23
|
|
23
|
-
opts.on(
|
24
|
+
opts.on('-f', '--format') do |f|
|
24
25
|
options[:format] = f
|
25
26
|
end
|
26
27
|
|
27
|
-
opts.on(
|
28
|
+
opts.on('-l', '--local', "Don't push results to Learn") do |l|
|
28
29
|
options[:local] = l
|
29
30
|
end
|
30
31
|
|
31
|
-
opts.on(
|
32
|
+
opts.on('-b', '--browser', 'Run tests in browser') do |b|
|
32
33
|
options[:browser] = b
|
33
34
|
end
|
34
35
|
|
35
|
-
opts.on(
|
36
|
+
opts.on('-o', '--out FILE') do |o|
|
36
37
|
options[:out] = o
|
37
38
|
end
|
38
39
|
|
39
|
-
opts.on(
|
40
|
+
opts.on('-s', '--skip') do |s|
|
40
41
|
options[:skip] = s
|
41
42
|
end
|
42
43
|
|
43
|
-
opts.on(
|
44
|
+
opts.on('-t', '--test') do |t|
|
44
45
|
options[:test] = t
|
45
46
|
end
|
46
47
|
|
47
|
-
opts.on(
|
48
|
+
opts.on('-v', '--version') do |v|
|
48
49
|
puts LearnTest::VERSION
|
49
50
|
exit
|
50
51
|
end
|
@@ -57,16 +58,16 @@ OptionParser.new do |opts|
|
|
57
58
|
options[:fail_fast] = f
|
58
59
|
end
|
59
60
|
|
60
|
-
opts.on(
|
61
|
+
opts.on('-e', '--example STRING', 'Run examples whose full nested names include STRING (may be used more than once)') do |s|
|
61
62
|
(options[:example] ||= []) << s
|
62
63
|
end
|
63
64
|
|
64
|
-
if ARGV.any? { |arg| arg ==
|
65
|
+
if ARGV.any? { |arg| arg == 'init' }
|
65
66
|
options[:init] = true
|
66
67
|
end
|
67
68
|
|
68
69
|
options[:argv] = ARGV
|
69
70
|
end.parse!
|
70
71
|
|
71
|
-
repo = options[:test] ?
|
72
|
+
repo = options[:test] ? 'git@github.com:flatiron-school/a-sample-repo.git' : LearnTest::RepoParser.get_repo
|
72
73
|
LearnTest::Runner.new(repo, options).run
|
data/bin/learn-test-wip
ADDED
@@ -0,0 +1,356 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
#
|
3
|
+
# Copyright Bart Trojanowski <bart@jukie.net>
|
4
|
+
#
|
5
|
+
# git-wip is a script that will manage Work In Progress (or WIP) branches.
|
6
|
+
# WIP branches are mostly throw away but identify points of development
|
7
|
+
# between commits. The intent is to tie this script into your editor so
|
8
|
+
# that each time you save your file, the git-wip script captures that
|
9
|
+
# state in git. git-wip also helps you return back to a previous state of
|
10
|
+
# development.
|
11
|
+
#
|
12
|
+
# See also http://github.com/bartman/git-wip
|
13
|
+
#
|
14
|
+
# The code is licensed as GPL v2 or, at your option, any later version.
|
15
|
+
# Please see http://www.gnu.org/licenses/gpl-2.0.txt
|
16
|
+
#
|
17
|
+
|
18
|
+
USAGE='[ info | save <message> [ --editor | --untracked | --no-gpg-sign ] | log [ --pretty ] | delete ] [ [--] <file>... ]'
|
19
|
+
LONG_USAGE="Manage Work In Progress branches
|
20
|
+
|
21
|
+
Commands:
|
22
|
+
git wip - create a new WIP commit
|
23
|
+
git wip save <message> - create a new WIP commit with custom message
|
24
|
+
git wip info [<branch>] - brief WIP info
|
25
|
+
git wip log [<branch>] - show changes on the WIP branch
|
26
|
+
git wip delete [<branch>] - delete a WIP branch
|
27
|
+
|
28
|
+
Options for save:
|
29
|
+
-e --editor - be less verbose, assume called from an editor
|
30
|
+
-u --untracked - capture also untracked files
|
31
|
+
-i --ignored - capture also ignored files
|
32
|
+
--no-gpg-sign - do not sign commit; that is, countermand
|
33
|
+
'commit.gpgSign = true'
|
34
|
+
|
35
|
+
Options for log:
|
36
|
+
-p --pretty - show a pretty graph
|
37
|
+
-r --reflog - show changes in reflog
|
38
|
+
-s --stat - show diffstat
|
39
|
+
"
|
40
|
+
|
41
|
+
. "$(git --exec-path)/git-sh-setup"
|
42
|
+
|
43
|
+
require_work_tree
|
44
|
+
|
45
|
+
TMP="$GIT_DIR/.git-wip.$$"
|
46
|
+
trap 'rm -f "$TMP-*"' 0
|
47
|
+
|
48
|
+
WIP_INDEX="$TMP-INDEX"
|
49
|
+
|
50
|
+
WIP_PREFIX=refs/wip/
|
51
|
+
WIP_COMMAND=
|
52
|
+
WIP_MESSAGE=WIP
|
53
|
+
EDITOR_MODE=false
|
54
|
+
|
55
|
+
dbg() {
|
56
|
+
if test -n "$WIP_DEBUG"
|
57
|
+
then
|
58
|
+
printf '# %s\n' "$*"
|
59
|
+
fi
|
60
|
+
}
|
61
|
+
|
62
|
+
# some errors are not worth reporting in --editor mode
|
63
|
+
report_soft_error () {
|
64
|
+
$EDITOR_MODE && exit 0
|
65
|
+
die "$@"
|
66
|
+
}
|
67
|
+
|
68
|
+
cleanup () {
|
69
|
+
rm -f "$TMP-*"
|
70
|
+
}
|
71
|
+
|
72
|
+
get_work_branch () {
|
73
|
+
ref=$(git symbolic-ref -q HEAD) \
|
74
|
+
|| report_soft_error "git-wip requires a branch"
|
75
|
+
|
76
|
+
|
77
|
+
branch=${ref#refs/heads/}
|
78
|
+
if [ $branch = $ref ] ; then
|
79
|
+
die "git-wip requires a local branch"
|
80
|
+
fi
|
81
|
+
|
82
|
+
echo $branch
|
83
|
+
}
|
84
|
+
|
85
|
+
get_wip_branch () {
|
86
|
+
return 0
|
87
|
+
}
|
88
|
+
|
89
|
+
check_files () {
|
90
|
+
local -a files="$@"
|
91
|
+
|
92
|
+
for f in "${files[@]}"
|
93
|
+
do
|
94
|
+
[ -f "$f" -o -d "$f" ] || die "$f: No such file or directory."
|
95
|
+
done
|
96
|
+
}
|
97
|
+
|
98
|
+
build_new_tree () {
|
99
|
+
local untracked=$1 ; shift
|
100
|
+
local ignored=$1 ; shift
|
101
|
+
local files="$@"
|
102
|
+
|
103
|
+
(
|
104
|
+
set -e
|
105
|
+
rm -f "$WIP_INDEX"
|
106
|
+
cp -p "$GIT_DIR/index" "$WIP_INDEX"
|
107
|
+
export GIT_INDEX_FILE="$WIP_INDEX"
|
108
|
+
git read-tree $wip_parent
|
109
|
+
if [ -n "$files" ]
|
110
|
+
then
|
111
|
+
git add -f "${files[@]}"
|
112
|
+
else
|
113
|
+
git add --update .
|
114
|
+
fi
|
115
|
+
[ -n "$untracked" ] && git add .
|
116
|
+
[ -n "$ignored" ] && git add -f -A .
|
117
|
+
git write-tree
|
118
|
+
rm -f "$WIP_INDEX"
|
119
|
+
)
|
120
|
+
}
|
121
|
+
|
122
|
+
do_save () {
|
123
|
+
local msg="$1" ; shift
|
124
|
+
local add_untracked=
|
125
|
+
local add_ignored=
|
126
|
+
local no_sign=
|
127
|
+
|
128
|
+
while test $# != 0
|
129
|
+
do
|
130
|
+
case "$1" in
|
131
|
+
-e|--editor)
|
132
|
+
EDITOR_MODE=true
|
133
|
+
;;
|
134
|
+
-u|--untracked)
|
135
|
+
add_untracked=t
|
136
|
+
;;
|
137
|
+
-i|--ignored)
|
138
|
+
add_ignored=t
|
139
|
+
;;
|
140
|
+
--no-gpg-sign)
|
141
|
+
no_sign=--no-gpg-sign
|
142
|
+
;;
|
143
|
+
--)
|
144
|
+
shift
|
145
|
+
break
|
146
|
+
;;
|
147
|
+
*)
|
148
|
+
[ -f "$1" ] && break
|
149
|
+
die "Unknown option '$1'."
|
150
|
+
;;
|
151
|
+
esac
|
152
|
+
shift
|
153
|
+
done
|
154
|
+
local files="$@"
|
155
|
+
local "add_untracked=$add_untracked"
|
156
|
+
local "add_ignored=$add_ignored"
|
157
|
+
|
158
|
+
if test ${#files} -gt 0
|
159
|
+
then
|
160
|
+
check_files "${files[@]}"
|
161
|
+
fi
|
162
|
+
|
163
|
+
dbg "msg=$msg"
|
164
|
+
dbg "files=$files"
|
165
|
+
|
166
|
+
local work_branch=$(get_work_branch)
|
167
|
+
local wip_branch="$WIP_PREFIX$work_branch"
|
168
|
+
|
169
|
+
dbg "work_branch=$work_branch"
|
170
|
+
dbg "wip_branch=$wip_branch"
|
171
|
+
|
172
|
+
# enable reflog
|
173
|
+
local wip_branch_file="$GIT_DIR/logs/$wip_branch"
|
174
|
+
dbg "wip_branch_file=$wip_branch_file"
|
175
|
+
mkdir -p "$(dirname "$wip_branch_file")"
|
176
|
+
: >>"$wip_branch_file"
|
177
|
+
|
178
|
+
if ! work_last=$(git rev-parse --verify $work_branch)
|
179
|
+
then
|
180
|
+
report_soft_error "'$work_branch' branch has no commits."
|
181
|
+
fi
|
182
|
+
|
183
|
+
dbg "work_last=$work_last"
|
184
|
+
|
185
|
+
if wip_last=$(git rev-parse --quiet --verify $wip_branch)
|
186
|
+
then
|
187
|
+
local base=$(git merge-base $wip_last $work_last) \
|
188
|
+
|| die "'work_branch' and '$wip_branch' are unrelated."
|
189
|
+
|
190
|
+
if [ $base = $work_last ] ; then
|
191
|
+
wip_parent=$wip_last
|
192
|
+
else
|
193
|
+
wip_parent=$work_last
|
194
|
+
fi
|
195
|
+
else
|
196
|
+
wip_parent=$work_last
|
197
|
+
fi
|
198
|
+
|
199
|
+
dbg "wip_parent=$wip_parent"
|
200
|
+
|
201
|
+
new_tree=$( build_new_tree "$add_untracked" "$add_ignored" "${files[@]}" ) \
|
202
|
+
|| die "Cannot save the current worktree state."
|
203
|
+
|
204
|
+
dbg "new_tree=$new_tree"
|
205
|
+
|
206
|
+
if git diff-tree --exit-code --quiet $new_tree $wip_parent ; then
|
207
|
+
report_soft_error "no changes"
|
208
|
+
fi
|
209
|
+
|
210
|
+
dbg "... has changes"
|
211
|
+
|
212
|
+
new_wip=$(printf '%s\n' "$msg" | git commit-tree $no_sign $new_tree -p $wip_parent 2>/dev/null) \
|
213
|
+
|| die "Cannot record working tree state"
|
214
|
+
|
215
|
+
dbg "new_wip=$new_wip"
|
216
|
+
|
217
|
+
msg1=$(printf '%s\n' "$msg" | sed -e 1q)
|
218
|
+
git update-ref -m "git-wip: $msg1" $wip_branch $new_wip $wip_last
|
219
|
+
|
220
|
+
dbg "SUCCESS"
|
221
|
+
}
|
222
|
+
|
223
|
+
do_info () {
|
224
|
+
local branch=$1
|
225
|
+
|
226
|
+
die "info not implemented"
|
227
|
+
}
|
228
|
+
|
229
|
+
do_log () {
|
230
|
+
local work_branch=$1
|
231
|
+
[ -z $branch ] && work_branch=$(get_work_branch)
|
232
|
+
local wip_branch="$WIP_PREFIX$work_branch"
|
233
|
+
|
234
|
+
local log_cmd="log"
|
235
|
+
local graph=""
|
236
|
+
local pretty=""
|
237
|
+
local stat=""
|
238
|
+
while [ -n "$1" ]
|
239
|
+
do
|
240
|
+
case "$1" in
|
241
|
+
-p|--pretty)
|
242
|
+
graph="--graph"
|
243
|
+
pretty="--pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr)%Creset' --abbrev-commit --date=relative"
|
244
|
+
;;
|
245
|
+
-s|--stat)
|
246
|
+
stat="--stat"
|
247
|
+
;;
|
248
|
+
-r|--reflog)
|
249
|
+
log_cmd="reflog"
|
250
|
+
;;
|
251
|
+
*)
|
252
|
+
break
|
253
|
+
;;
|
254
|
+
esac
|
255
|
+
shift
|
256
|
+
done
|
257
|
+
|
258
|
+
if [ $log_cmd = reflog ]
|
259
|
+
then
|
260
|
+
echo git reflog $stat $pretty $wip_branch | sh
|
261
|
+
return $?
|
262
|
+
fi
|
263
|
+
|
264
|
+
if ! work_last=$(git rev-parse --verify $work_branch)
|
265
|
+
then
|
266
|
+
die "'$work_branch' branch has no commits."
|
267
|
+
fi
|
268
|
+
|
269
|
+
dbg work_last=$work_last
|
270
|
+
|
271
|
+
if ! wip_last=$(git rev-parse --quiet --verify $wip_branch)
|
272
|
+
then
|
273
|
+
die "'$work_branch' branch has no commits."
|
274
|
+
fi
|
275
|
+
|
276
|
+
dbg wip_last=$wip_last
|
277
|
+
|
278
|
+
local base=$(git merge-base $wip_last $work_last)
|
279
|
+
|
280
|
+
dbg base=$base
|
281
|
+
|
282
|
+
echo git log $graph $stat $pretty $@ $wip_last $work_last "^$base~1" | sh
|
283
|
+
}
|
284
|
+
|
285
|
+
do_delete () {
|
286
|
+
local branch=$1
|
287
|
+
|
288
|
+
die "delete not implemented"
|
289
|
+
}
|
290
|
+
|
291
|
+
do_help () {
|
292
|
+
local rc=$1
|
293
|
+
|
294
|
+
cat <<END
|
295
|
+
Usage: git wip $USAGE
|
296
|
+
|
297
|
+
$LONG_USAGE
|
298
|
+
END
|
299
|
+
exit $rc
|
300
|
+
}
|
301
|
+
|
302
|
+
|
303
|
+
if test $# -eq 0
|
304
|
+
then
|
305
|
+
dbg "no arguments"
|
306
|
+
|
307
|
+
do_save "WIP"
|
308
|
+
exit $?
|
309
|
+
fi
|
310
|
+
|
311
|
+
dbg "args: $@"
|
312
|
+
|
313
|
+
case "$1" in
|
314
|
+
save)
|
315
|
+
WIP_COMMAND=$1
|
316
|
+
shift
|
317
|
+
if [ -n "$1" ]
|
318
|
+
then
|
319
|
+
WIP_MESSAGE="$1"
|
320
|
+
shift
|
321
|
+
fi
|
322
|
+
;;
|
323
|
+
info|log|delete)
|
324
|
+
WIP_COMMAND=$1
|
325
|
+
shift
|
326
|
+
;;
|
327
|
+
help)
|
328
|
+
do_help 0
|
329
|
+
;;
|
330
|
+
--*)
|
331
|
+
;;
|
332
|
+
*)
|
333
|
+
[ -f "$1" ] || die "Unknown command '$1'."
|
334
|
+
;;
|
335
|
+
esac
|
336
|
+
|
337
|
+
case $WIP_COMMAND in
|
338
|
+
save)
|
339
|
+
do_save "$WIP_MESSAGE" $@
|
340
|
+
;;
|
341
|
+
info)
|
342
|
+
do_info $@
|
343
|
+
;;
|
344
|
+
log)
|
345
|
+
do_log $@
|
346
|
+
;;
|
347
|
+
delete)
|
348
|
+
do_delete $@
|
349
|
+
;;
|
350
|
+
*)
|
351
|
+
usage
|
352
|
+
exit 1
|
353
|
+
;;
|
354
|
+
esac
|
355
|
+
|
356
|
+
# vim: set noet sw=8
|