/**
 * Module dependencies
 */

import {spawn} from 'child_process'
import hooks from './hooks'

/**
 * Hook script runner class
 *
 * @class Runner
 * @classdesc Automatically runs a specified hook script once instantiated from
 * within a Git hook script ($GIT_DIR/hooks/<hook-name>). Can be used elsewhere
 */

export default class Runner {
  /**
   * Constructs an instance of Runner
   *
   * @param {string} hook - Name of hook script
   * @constructs Runner
   */

  constructor (hook) {
    this.hook = this._validate(hook)
  }

  /**
   * Asynchronously runs "npm test -s" when this Runner's hook script is called
   * by Git by spawning a child process
   *
   * Parent process shares readable and writable stream objects with the child
   * process to preserve child process' STDOUT formatting
   *
   * For more see {@link
   * https://nodejs.org/api/child_process.html#child_process_options_stdio |
   * child_process options.stdio "inherit"}
   *
   * @method run
   * @public
   */

  run () {
    spawn('npm', ['test', '-s'], {
      stdio: [process.stdin, process.stdout, process.stderr]
    })
  }

  /**
   * Validates whether or not a provided hook is recognized by Git
   *
   * @method _validate
   * @param {*} hook - Hook name to validate
   * @throws {InvalidHookError} Thrown if hook is not recognized by Git
   * @returns {string} Valid hook name
   * @protected
   */

  _validate (hook) {
    if (typeof hook === 'undefined') {
      throw new Error('Missing required hook argument')
    }

    if (hooks.indexOf(hook) === -1) {
      throw new Error(`"${hook}" is not valid hook name`)
    }

    return hook
  }
}

@@ -434,16 +434,94 @@
  script%0A
+   * @param %7Bstring%7D %5Bconfig=../../package.json%5D - Path to target JSON config%0A
    * @co
@@ -558,24 +558,55 @@
 ructor (hook
+, config = '../../package.json'
 ) %7B%0A    this
@@ -634,16 +634,41 @@
 e(hook)%0A
+    this.config = config%0A
   %7D%0A%0A  /

Add optional config parameter to constructor