Class: Guard::JestRunner
- Inherits:
-
Plugin
- Object
- Plugin
- Guard::JestRunner
- Defined in:
- lib/guard/jest_runner.rb,
lib/guard/jest_runner/runner.rb
Defined Under Namespace
Classes: Runner
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ JestRunner
constructor
Initializes a Guard plugin.
-
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed.
-
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
-
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
-
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
-
#start ⇒ Object
Called once when Guard starts.
Constructor Details
#initialize(options = {}) ⇒ JestRunner
Initializes a Guard plugin. Don’t do any work here, especially as Guard plugins get initialized
even if they are not in an active group!
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/guard/jest_runner.rb', line 18 def initialize( = {}) super @options = { all_on_start: false, keep_failed: true, notification: true, cli: nil, command: 'jest', default_paths: ['**/*.js', '**/*.es6'], }.merge() @failed_paths = [] end |
Instance Method Details
#reload ⇒ Object
Called when ‘reload|r|z + enter` is pressed. This method should be mainly used for “reload” (really!) actions like reloading
passenger/spork/bundler/...
50 51 52 |
# File 'lib/guard/jest_runner.rb', line 50 def reload runner.reload end |
#run_all ⇒ Object
Called when just ‘enter` is pressed This method should be principally used for long action like running all specs/tests/…
60 61 62 63 |
# File 'lib/guard/jest_runner.rb', line 60 def run_all Compat::UI.info 'Running jest for all Javascript files' inspect_with_jest end |
#run_on_additions(paths) ⇒ Object
Called on file(s) additions that the Guard plugin watches.
71 72 73 |
# File 'lib/guard/jest_runner.rb', line 71 def run_on_additions(paths) run_partially(paths) end |
#run_on_modifications(paths) ⇒ Object
Called on file(s) modifications that the Guard plugin watches.
81 82 83 |
# File 'lib/guard/jest_runner.rb', line 81 def run_on_modifications(paths) run_partially(paths) end |
#start ⇒ Object
Called once when Guard starts. Please override initialize method to init stuff.
38 39 40 41 |
# File 'lib/guard/jest_runner.rb', line 38 def start Compat::UI.info 'Guard::JestRunner is running' run_all if [:all_on_start] end |