Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/robindaugherty/guard-jest_runner
Guard to run jest
https://github.com/robindaugherty/guard-jest_runner
guard jest red-green-refactor tdd
Last synced: about 1 month ago
JSON representation
Guard to run jest
- Host: GitHub
- URL: https://github.com/robindaugherty/guard-jest_runner
- Owner: RobinDaugherty
- Created: 2018-11-16T20:19:23.000Z (almost 6 years ago)
- Default Branch: master
- Last Pushed: 2020-12-24T09:28:43.000Z (almost 4 years ago)
- Last Synced: 2024-10-07T02:16:03.474Z (about 1 month ago)
- Topics: guard, jest, red-green-refactor, tdd
- Language: Ruby
- Homepage: https://rubygems.org/gems/guard-jest_runner
- Size: 14.6 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Guard::JestRunner
Guard::JestRunner allows you to automatically run jest when you change a Javascript/ES6 file.
Unlike [guard-jest](https://rubygems.org/gems/guard-jest), this guard runs just as directed by your Guardfile, which allows you to use it in a group and use a Red-Green-Refactor process.
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'guard-jest_runner'
```And then execute:
$ bundle
Or install it yourself as:
$ gem install guard-jest_runner
## Usage
Please read [Guard usage doc](https://github.com/guard/guard#readme).
## Guardfile
For a typical Rails app with webpack:
``` ruby
guard :jest do
watch(%r{app/javascript/(.+)\.js$}) { |m| "spec/javascript/#{m[1]}.test.js" }
watch(%r{spec/javascript/.+\.js$})
end
```(**Recommended**) pair up with guard-eslint to get a Red-Green-Refactor process:
```ruby
group :red_green_refactor_js, halt_on_fail: true do
guard :jest_runner do
watch(%r{app/javascript/(.+)\.js$}) { |m| "spec/javascript/#{m[1]}.test.js" }
watch(%r{spec/javascript/.+\.js$})
endguard :eslint, formatter: 'codeframe' do
watch(%r{app/javascript/(.+)\.js$}) { |m| ""}
watch(%r{spec/javascript/(.+)\.js$})
end
end
```### List of available options:
``` ruby
all_on_start: false # Run all specs after changed specs pass.
keep_failed: true # Keep failed files until they pass (add them to new ones)
notification: true # Display notification always when jest completes.
# If you want to notify only on failure, set to :failure.
cli: nil # Additional command-line options to pass to jest.
# Don't use the '-f' or '--format' option here.
command: 'jest' # Specify a custom path to the jest command.
default_paths: ['**/*.js', '**/*.es6'] # The default paths that will be used for "all_on_start".
```## Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/RobinDaugherty/guard-jest_runner.
* Please create a topic branch for every separate change you make.
* Make sure your patches are well-tested.
* Update the README to reflect your changes.
* Please **do not change** the version number.
* Open a pull request.