function runner() {
	var pattern;
	var options;
	var gopts;
	var clbk;
	var opts;
	var err;
	var dir;

	pattern = arguments[ 0 ];
	if ( !isString( pattern ) ) {
		throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', pattern ) );
	}
	opts = copy( defaults );
	if ( arguments.length > 2 ) {
		options = arguments[ 1 ];
		clbk = arguments[ 2 ];
		err = validate( opts, options );
		if ( err ) {
			throw err;
		}
	} else {
		clbk = arguments[ 1 ];
	}
	dir = cwd();
	if ( opts.dir === void 0 ) {
		opts.dir = dir;
	} else {
		opts.dir = resolve( dir, opts.dir );
	}
	if ( !isFunction( clbk ) ) {
		throw new TypeError( format( 'invalid argument. Last argument must be a function. Value: `%s`.', clbk ) );
	}
	gopts = {
		'cwd': opts.dir,
		'realpath': true // return absolute file paths
	};
	glob( pattern, gopts, onGlob );

	/**
	* Callback invoked upon receiving glob results.
	*
	* @private
	* @param {(Error|null)} error - error object
	* @param {StringArray} files - absolute filepaths for filenames which matched the glob pattern
	* @returns {void}
	*/
	function onGlob( error, files ) {
		if ( error ) {
			return done( error );
		}
		readFiles( files );
	}

	/**
	* Reads files.
	*
	* @private
	* @param {StringArray} files - files to read
	*/
	function readFiles( files ) {
		var count;
		var cache;
		var opts;
		var cb;
		var i;

		opts = {
			'encoding': 'utf8'
		};
		count = 0;
		cache = {};
		for ( i = 0; i < files.length; i++ ) {
			cb = onReadFactory( files[ i ], onData );
			readFile( files[ i ], opts, cb );
		}
		/**
		* Callback invoked upon reading a file.
		*
		* @private
		* @param {string} filename - filename
		* @param {string} data - content
		*/
		function onData( filename, data ) {
			cache[ filename ] = data;
			count += 1;
			if ( count === files.length ) {
				compileFiles( cache );
			}
		}
	}

	/**
	* Returns a callback to be invoked upon reading a file.
	*
	* @private
	* @param {string} id - file id
	* @param {Callback} clbk - callback
	* @returns {void}
	*/
	function onReadFactory( id, clbk ) {
		return onRead;
		/**
		* Callback invoked upon reading a file.
		*
		* @private
		* @param {(Error|null)} error - error object
		* @param {(Buffer|string)} data - file content
		* @returns {void}
		*/
		function onRead( error, data ) {
			if ( error ) {
				return done( error );
			}
			clbk( id, data.toString() );
		}
	}

	/**
	* Compiles source code.
	*
	* @private
	* @param {Object} code - object containing source code
	*/
	function compileFiles( code ) {
		var keys;
		var key;
		var i;
		keys = objectKeys( code );
		for ( i = 0; i < keys.length; i++ ) {
			key = keys[ i ];
			code[ key ] = compile( key, code[ key ] );
		}
		evaluate( code );
	}

	/**
	* Evaluates compiled code.
	*
	* @private
	* @param {Object} code - object containing compiled code
	*/
	function evaluate( code ) {
		var filename;
		var require;
		var keys;
		var fcn;
		var i;

		// Add a listener for when `tape` tests finish:
		tape.onFinish( done );

		// Run the compiled code...
		keys = objectKeys( code );
		for ( i = 0; i < keys.length; i++ ) {
			filename = keys[ i ];
			fcn = code[ filename ];
			require = createRequire( filename );
			fcn( require, filename, dirname( filename ) );
		}
	}

	/**
	* Callback invoked upon completion.
	*
	* @private
	* @param {Error} [error] - error object
	* @returns {void}
	*/
	function done( error ) {
		if ( error ) {
			return clbk( error );
		}
		clbk( null, coverage( opts.global ) );
	}
}
Test runner for instrumented source code.

@private
@param {string} pattern - search pattern
@param {Options} [options] - function options
@param {string} [options.dir] - root directory from which to search for test files
@param {string} [options.global='__coverage__'] - global coverage variable
@param {Callback} clbk - callback to invoke upon completion
@throws {TypeError} first argument must be a string
@throws {TypeError} last argument must be a function
@throws {TypeError} options argument must be an object
@throws {TypeError} must provide valid options

@example
var proc = require( 'process' );

var pattern = 'test*.js';

var opts = {
    'dir': proc.cwd()
};

function done( error, coverage ) {
    if ( error ) {
        throw error;
    }
    console.log( JSON.stringify( coverage ) );
}

runner( pattern, opts, done );