Project

guard-jest

0.0
No commit activity in last 3 years
No release in over 3 years
Guard plugin for testing Javascript using the Jest test runner
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 10.0
~> 3.5

Runtime

 Project Readme

Build Status

Guard::Jest automatically tests your Jest specs when files are modified.

It runs the Jest server in watch mode, so that it can run specs more efficiently when instructed.

Installation

Add this line to your application's Gemfile:

Add Guard::Jest to your Gemfile:

group :development, :test do
  gem 'guard-jest'
end

Add the default Guard::Jest template to your Guardfile by running:

$ guard init jest

Usage

Please read the Guard usage documentation.

Guardfile

Guard::Jest can be adapted to all kind of projects. Please read the Guard documentation for more information about the Guardfile DSL.

guard 'jest' do
  watch(%r{spec/javascripts/spec\.(js\.coffee|js|coffee)$})         { "spec/javascripts" }
  watch(%r{spec/javascripts/.+_spec\.(js\.coffee|js|coffee)$})
  watch(%r{app/assets/javascripts/(.+?)\.(js\.coffee|js|coffee)$})  { |m| "spec/javascripts/#{m[1]}_spec.#{m[2]}" }
end

Interactive use

From the Guard console, typeing 'j u' and pressing enter will trigger a snaphot update.

Options

There are many options that can customize Guard::Jest to your needs. Options are simply supplied as hash when defining the Guard in your Guardfile:

guard 'jest', jest_cmd: './node_modules/jest-cli/bin/jest.js' do
  ...
end

Server options

The server options configures the server environment that is needed to run Guard::Jest:

directory:    <cwd>                           # Directory that should be used for running Jest
config_file:  nil                             # Path to a [Jest configuration file](https://facebook.github.io/jest/docs/configuration.html)

jest_cmd:     jest                            # Command to execute in order to start the Jest server

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nathanstitt/guard-jest.

License

The gem is available as open source under the terms of the MIT License.