├── .gitignore ├── tasks └── jest.js ├── package.json └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | .*.haste_cache.* 2 | node_modules 3 | npm-debug.log 4 | .DS_Store 5 | *~ 6 | *.swp 7 | -------------------------------------------------------------------------------- /tasks/jest.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | module.exports = function(grunt) { 4 | 5 | grunt.registerTask('jest', 'Run tests with Jest.', function() { 6 | require('jest-cli').runCLI(this.options(), process.cwd(), this.async()); 7 | }); 8 | 9 | }; 10 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "grunt-jest", 3 | "version": "0.4.0", 4 | "description": "Grunt task to run tests with Jest.", 5 | "repository": { 6 | "type": "git", 7 | "url": "git://github.com/leebyron/grunt-jest.git" 8 | }, 9 | "keywords": [ 10 | "gruntplugin", 11 | "jest", 12 | "test" 13 | ], 14 | "author": "Lee Byron", 15 | "license": "MIT", 16 | "bugs": { 17 | "url": "https://github.com/leebyron/grunt-jest/issues" 18 | }, 19 | "homepage": "https://github.com/leebyron/grunt-jest", 20 | "peerDependencies": { 21 | "jest-cli": "*" 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | 3 | `grunt-jest` is deprecated as there are now much better ways to use Grunt and 4 | Jest together. 5 | 6 | Read [Jest getting started](https://facebook.github.io/jest/#getting-started) 7 | describing adding an npm script which calls jest, then use the fantastic 8 | [`grunt-run`](https://github.com/spalger/grunt-run) plugin to run Jest (or any 9 | other npm script!) directly from your Grunt config. 10 | 11 | 12 | # grunt-jest v0.1.0 13 | 14 | Grunt task to run tests with [Jest](http://facebook.github.io/jest/). 15 | 16 | 17 | 18 | ## Getting Started 19 | This plugin requires Grunt `~0.4.0` 20 | 21 | If you haven't used [Grunt](http://gruntjs.com/) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide, as it explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile) as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command: 22 | 23 | ```shell 24 | npm install grunt-jest --save-dev 25 | ``` 26 | 27 | Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript: 28 | 29 | ```js 30 | grunt.loadNpmTasks('grunt-jest'); 31 | ``` 32 | 33 | 34 | 35 | ## Run tests 36 | _Run this task with the `grunt jest` command._ 37 | 38 | Task options may be specified according to the grunt [Configuring tasks](http://gruntjs.com/configuring-tasks) guide. 39 | ### Options 40 | 41 | #### config 42 | Type: `String` srcpath 43 | 44 | The path to a jest config file specifying how to find and execute tests. 45 | 46 | #### testPathPattern 47 | Type: `RegExp` 48 | Default: `/.*/` 49 | 50 | Only tests which match this pattern will execute. 51 | 52 | #### coverage 53 | Type: `Boolean` 54 | Default: `false` 55 | 56 | Indicates that test coverage information should be collected and reported in the output. 57 | 58 | #### maxWorkers 59 | Type: `Number` 60 | Default: Number of cores available on this machine. 61 | 62 | Specifies the maximum number of workers the worker-pool will spawn for running tests. 63 | (it is usually best not to override this default) 64 | 65 | #### onlyChanged 66 | Type: `Boolean` 67 | Default: `false` 68 | 69 | Attempts to identify which tests to run based on which files have changed in 70 | the current repository. Only works if you're running tests in a git repository at the moment. 71 | 72 | #### runInBand 73 | Type: `Boolean` 74 | Default: `false` 75 | 76 | Run all tests serially in the current process (rather than creating a worker pool of child 77 | processes that run tests). This is sometimes useful for debugging, but such use cases are pretty rare. 78 | 79 | 80 | 81 | ### Usage Examples 82 | 83 | ```js 84 | jest: { 85 | options: { 86 | coverage: true, 87 | testPathPattern: /.*-test.js/ 88 | } 89 | } 90 | ``` 91 | --------------------------------------------------------------------------------