hypertest 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +42 -28
- data/hypertest.gemspec +1 -1
- data/lib/hypertest.rb +10 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6930c06ce78711116889215c13cc2937d6832efb7e0cd72175151695d7c2beb1
|
4
|
+
data.tar.gz: '090b6239a6837ac9e8d4269346b930c6b786abe97fd2035e7b02be9c4602770d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e4d1cd1b6bc3747c5dcf017c5aba98ff05adebf93781ce54df4d094f3f1536b9e0357c679f0d90adf6c01bc2453dccc106e7f1a09551d3deec52b812e2b752f5
|
7
|
+
data.tar.gz: 1f355af1a5aa0b4b9698e18d833a240cdba49a1e6d84e1c63e70b7328a88ad8a702bef0106a53780fda542e8f151baccea7bade8a9034eadd5a3ba185cf20e3c
|
data/README.md
CHANGED
@@ -1,39 +1,53 @@
|
|
1
1
|
# Hypertest
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Hypertest is a very simple tool to help you run fast test suites in a very tight
|
4
|
+
dev loop on file changes.
|
6
5
|
|
7
6
|
## Installation
|
8
7
|
|
9
|
-
Add
|
8
|
+
Add `gem 'hypertest'` to your Gemfile, maybe in a `:development, :test` group,
|
9
|
+
then `bundle install`. `gem 'bootsnap'` is also recommended.
|
10
|
+
|
11
|
+
Generally you will want to use Hypertest by creating a file like:
|
10
12
|
|
11
13
|
```ruby
|
12
|
-
|
14
|
+
#!/usr/bin/env ruby
|
15
|
+
# bin/hypertest
|
16
|
+
|
17
|
+
require 'bundler/setup'
|
18
|
+
Bundler.require(:development, :test)
|
19
|
+
|
20
|
+
ROOT = File.expand_path('..', __dir__)
|
21
|
+
$LOAD_PATH.unshift(File.join(ROOT, 'lib'))
|
22
|
+
$LOAD_PATH.unshift(File.join(ROOT, 'test'))
|
23
|
+
|
24
|
+
# Bootsnap isn't necessary but generally speeds things up even further.
|
25
|
+
Bootsnap.setup(
|
26
|
+
cache_dir: "#{ROOT}/tmp/cache",
|
27
|
+
ignore_directories: [],
|
28
|
+
development_mode: true,
|
29
|
+
load_path_cache: true,
|
30
|
+
compile_cache_iseq: true,
|
31
|
+
compile_cache_yaml: true,
|
32
|
+
compile_cache_json: true,
|
33
|
+
readonly: false,
|
34
|
+
)
|
35
|
+
|
36
|
+
Hypertest.run do
|
37
|
+
require 'test_helper'
|
38
|
+
Dir.glob('test/**/*_test.rb').each do |file|
|
39
|
+
require File.join(ROOT, file)
|
40
|
+
end
|
41
|
+
end
|
13
42
|
```
|
14
43
|
|
15
|
-
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
|
-
$ gem install hypertest
|
22
|
-
|
23
|
-
## Usage
|
24
|
-
|
25
|
-
TODO: Write usage instructions here
|
26
|
-
|
27
|
-
## Development
|
28
|
-
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
|
-
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
32
|
-
|
33
|
-
## Contributing
|
34
|
-
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/burke/hypertest.
|
44
|
+
This loads ruby and your bundle, then forks to load your test helper and tests
|
45
|
+
after each file change. Happy hacking!
|
36
46
|
|
37
|
-
##
|
47
|
+
## Limitations
|
38
48
|
|
39
|
-
|
49
|
+
* Only works on macOS because I've only implemented this with FSEvents. Patches
|
50
|
+
welcome.
|
51
|
+
* Path filtering (`ignore:`) can only match on directory paths because the
|
52
|
+
FSEvents library doesn't seem to want to let me use `file_events: true`.
|
53
|
+
*
|
data/hypertest.gemspec
CHANGED
data/lib/hypertest.rb
CHANGED
@@ -46,10 +46,18 @@ module Hypertest
|
|
46
46
|
def print_result(t1, t2, stat)
|
47
47
|
ms = ((t2 - t1) * 1000).round
|
48
48
|
if stat.success?
|
49
|
-
|
49
|
+
info("Completed in #{ms}ms")
|
50
50
|
else
|
51
|
-
|
51
|
+
err("Failed in #{ms}ms")
|
52
52
|
end
|
53
53
|
end
|
54
|
+
|
55
|
+
def info(msg)
|
56
|
+
STDERR.puts("\x1b[1;34m%% #{msg}\x1b[0m")
|
57
|
+
end
|
58
|
+
|
59
|
+
def err(msg)
|
60
|
+
STDERR.puts("\x1b[1;31m%% #{msg}\x1b[0m")
|
61
|
+
end
|
54
62
|
end
|
55
63
|
end
|