UNPKG

orionsoft-react-scripts

Version:

Orionsoft Configuration and scripts for Create React App.

889 lines (805 loc) 30.1 kB
<html> <head> <meta charset='utf-8' /> <title>istanbul-api 1.0.0-alpha.4 | Documentation</title> <meta name='viewport' content='width=device-width,initial-scale=1'> <link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:400,700|Source+Code+Pro:400,500,700' rel='stylesheet' type='text/css'> <link href='assets/bass.css' type='text/css' rel='stylesheet' /> <link href='assets/style.css' type='text/css' rel='stylesheet' /> <link href='assets/github.css' type='text/css' rel='stylesheet' /> </head> <body class='documentation'> <div class='container'> <div class='clearfix md-mxn2'> <div class='fixed md-show fix-3 overflow-auto max-height-100'> <div class='py1 px2'> <h3 class='mb0 no-anchor'>istanbul-api</h3> <div class='mb1'><code>1.0.0-alpha.4</code></div> <input placeholder='Filter' id='filter-input' class='col12 block field' type='text' /> <div id='toc'> <a href='#Exports' class='block bold'> Exports </a> <a href='#Config' class='block bold'> Config </a> <a href='#add' class='block bold'> add </a> <a href='#addAll' class='block bold'> addAll </a> <a href='#write' class='block bold'> write </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#addMethods' class='block bold'> addMethods </a> <a href='#config' class='block bold'> config </a> <a href='#config' class='block bold'> config </a> <a href='#config' class='block bold'> config </a> <a href='#config' class='block bold'> config </a> <a href='#defaultConfig' class='block bold'> defaultConfig </a> <a href='#loadFile' class='block bold'> loadFile </a> <a href='#loadObject' class='block bold'> loadObject </a> <a href='#excludes' class='block bold'> excludes </a> <a href='#root' class='block bold'> root </a> <a href='#loadFile' class='block bold'> loadFile </a> <a href='#loadFile' class='block bold'> loadFile </a> <a href='#loadFile' class='block bold'> loadFile </a> <a href='#loadFile' class='block bold'> loadFile </a> <a href='#matcherFor' class='block bold'> matcherFor </a> <a href='#watermarks' class='block bold'> watermarks </a> </div> </div> </div> <div class='fix-margin-3'> <div class='px2'> <div class='py1'><section class='py2 clearfix'> <h2 id='Exports' class='mt0'> Exports<span class='gray'></span> </h2> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='Config' class='mt0'> Config<span class='gray'></span> </h2> <p>methods to load the configuration object.</p> <h2>Usage</h2> <pre><code> var config = require(&apos;istanbul&apos;).config, configObj = config.loadFile(); console.log(configObj.reporting.reports()); </code></pre> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='add' class='mt0'> add<span class='gray'>(fmt)</span> </h2> <p>adds a report to be generated. Must be one of the entries returned by <code>Report.getReportList()</code></p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>fmt</strong> : <span class='force-inline'> <p>the format of the report to generate</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addAll' class='mt0'> addAll<span class='gray'>(fmts)</span> </h2> <p>adds an array of report formats to be generated</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code> <strong>fmts</strong> : <span class='force-inline'> <p>an array of report formats</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='write' class='mt0'> write<span class='gray'>(coverageMap, opts)</span> </h2> <p>writes all reports added</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>coverageMap</strong> : <span class='force-inline'> </span> </li> <li> <strong>opts</strong> : <span class='force-inline'> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns a list of reports that should be generated at the end of a run. Used by the <code>cover</code> and <code>report</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code></code> : <span class='force-inline'> <p>an array of reports that should be produced</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if comments should be preserved in the generated JS. Used by the <code>cover</code> and <code>instrument</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if comments should be preserved in the generated JS</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>Sets the baseline coverage filename. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>the name of the baseline coverage file.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if comments the JS to instrument contains es6 Module syntax.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if code contains es6 import/export statements.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if the coverage filename should include the PID. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true to include pid in coverage filename.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if the output should be compact JS. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if the output should be compact</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if non-JS files should be copied during instrumentation. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if non-JS files should be copied</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns the kind of information to be printed on the console. May be one of <code>summary</code>, <code>detail</code>, <code>both</code> or <code>none</code>. Used by the <code>cover</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>the kind of information to print to the console at the end of the <code>cover</code> command execution.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if a zero-coverage baseline file should be written as part of instrumentation. This allows reporting to display numbers for files that have no tests. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if a baseline coverage file should be written.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns the directory under which reports should be generated. Used by the <code>cover</code> and <code>report</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>the directory under which reports should be generated.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns an object that has keys that are report format names and values that are objects containing detailed configuration for each format. Running <code>istanbul help config</code> will give you all the keys per report format that can be overridden. Used by the <code>cover</code> and <code>report</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></code> : <span class='force-inline'> <p>detailed report configuration per report format.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>the coverage variable name to use. Used by the <code>instrument</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>the coverage variable name to use</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if default excludes should be turned on. Used by the <code>cover</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if default excludes should be turned on</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if <code>vm.runInThisContext</code> needs to be hooked, in addition to the standard <code>require</code> hooks added by istanbul. This should be true for code that uses RequireJS for example. Used by the <code>cover</code> command.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if <code>vm.runInThisContext</code> needs to be hooked for coverage</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns a path to JS file or a dependent module that should be used for post-processing files after they have been required. See the <code>yui-istanbul</code> module for an example of a post-require hook. This particular hook modifies the yui loader when that file is required to add istanbul interceptors. Use by the <code>cover</code> command</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>a path to a JS file or the name of a node module that needs to be used as a <code>require</code> post-processor</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='addMethods' class='mt0'> addMethods<span class='gray'></span> </h2> <p>returns if istanbul needs to add a SIGINT (control-c, usually) handler to save coverage information. Useful for getting code coverage out of processes that run forever and need a SIGINT to terminate.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">Boolean</a></code></code> : <span class='force-inline'> <p>true if SIGINT needs to be hooked to write coverage information</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='config' class='mt0'> config<span class='gray'>(config)</span> </h2> <p>Object that returns hook options. Note that istanbul does not provide an option to hook <code>require</code>. This is always done by the <code>cover</code> command.</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>config</strong> : <span class='force-inline'> <p>the hooks part of the config object</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='config' class='mt0'> config<span class='gray'>(config)</span> </h2> <p>Object that returns instrumentation options</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>config</strong> : <span class='force-inline'> <p>the instrumentation part of the config object</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='config' class='mt0'> config<span class='gray'>(obj, overrides)</span> </h2> <p>represents the istanbul configuration and provides sub-objects that can return instrumentation, reporting and hook options respectively.</p> <h2>Usage</h2> <pre><code> var configObj = require(&apos;istanbul&apos;).config.loadFile(); console.log(configObj.reporting.reports()); </code></pre> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>obj</strong> : <span class='force-inline'> <p>the base object to use as the configuration</p> </span> </li> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>overrides</strong> : <span class='force-inline'> <p>optional - override attributes that are merged into the base config</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='config' class='mt0'> config<span class='gray'>(config)</span> </h2> <p>Object that returns reporting options</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>config</strong> : <span class='force-inline'> <p>the reporting part of the config object</p> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='defaultConfig' class='mt0'> defaultConfig<span class='gray'></span> </h2> <p>returns the default configuration object. Note that this is a plain object and not a <code>Configuration</code> instance.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></code> : <span class='force-inline'> <p>an object that represents the default config</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadFile' class='mt0'> loadFile<span class='gray'>(file, overrides)</span> </h2> <p>loads the specified configuration file with optional overrides. Throws when a file is specified and it is not found.</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code> <strong>file</strong> : <span class='force-inline'> <p>the file to load. If falsy, the default config file, if present, is loaded. If not a default config is used.</p> </span> </li> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>overrides</strong> : <span class='force-inline'> <p>an object with override keys that are merged into the config object loaded</p> </span> </li> </ul> <h4>Returns</h4> <code><code>Configuration</code></code> : <span class='force-inline'> <p>the config object with overrides applied</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadObject' class='mt0'> loadObject<span class='gray'>(obj, overrides)</span> </h2> <p>loads the specified configuration object with optional overrides.</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>obj</strong> : <span class='force-inline'> <p>the object to use as the base configuration.</p> </span> </li> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>overrides</strong> : <span class='force-inline'> <p>an object with override keys that are merged into the config object</p> </span> </li> </ul> <h4>Returns</h4> <code><code>Configuration</code></code> : <span class='force-inline'> <p>the config object with overrides applied</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='excludes' class='mt0'> excludes<span class='gray'>(excludeTests)</span> </h2> <p>returns an array of fileset patterns that should be excluded for instrumentation. Used by the <code>instrument</code> and <code>cover</code> commands.</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>excludeTests</strong> : <span class='force-inline'> </span> </li> </ul> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code></code> : <span class='force-inline'> <p>an array of fileset patterns that should be excluded for instrumentation.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='root' class='mt0'> root<span class='gray'></span> </h2> <p>returns the root directory used by istanbul which is typically the root of the source tree. Used by the <code>cover</code> and <code>report</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code></code> : <span class='force-inline'> <p>the root directory used by istanbul.</p> </span> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadFile' class='mt0'> loadFile<span class='gray'>(file, overrides)</span> </h2> <p>hook options</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>file</strong> : <span class='force-inline'> </span> </li> <li> <strong>overrides</strong> : <span class='force-inline'> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadFile' class='mt0'> loadFile<span class='gray'>(file, overrides)</span> </h2> <p>true if verbose logging is required</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>file</strong> : <span class='force-inline'> </span> </li> <li> <strong>overrides</strong> : <span class='force-inline'> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadFile' class='mt0'> loadFile<span class='gray'>(file, overrides)</span> </h2> <p>instrumentation options</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>file</strong> : <span class='force-inline'> </span> </li> <li> <strong>overrides</strong> : <span class='force-inline'> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='loadFile' class='mt0'> loadFile<span class='gray'>(file, overrides)</span> </h2> <p>reporting options</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li> <strong>file</strong> : <span class='force-inline'> </span> </li> <li> <strong>overrides</strong> : <span class='force-inline'> </span> </li> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='matcherFor' class='mt0'> matcherFor<span class='gray'>(options)</span> </h2> <p>asynchronously returns a function that can match filesystem paths. The function returned in the callback may be passed directly as a <code>matcher</code> to the functions in the <code>hook</code> module.</p> <p>When no options are passed, the match function is one that matches all JS files under the current working directory except ones under <code>node_modules</code></p> <p>Match patterns are <code>ant</code>-style patterns processed using the <code>fileset</code> library. Examples not provided due to limitations in putting asterisks inside jsdoc comments. Please refer to tests under <code>test/other/test-matcher.js</code> for examples.</p> <h4>Parameters</h4> <ul class='suppress-p-margin'> <li><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code> <strong>options</strong> : <span class='force-inline'> <p>Optional. Lookup options.</p> </span> </li> <ul> <li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">String</a></code>]</code> options.root <p>the root of the filesystem tree under which to match files. Defaults to <code>process.cwd()</code></p> </li> <li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code>]</code> options.includes <p>an array of include patterns to match. Defaults to all JS files under the root.</p> </li> <li><code>[<code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array">Array</a></code>]</code> options.excludes <p>and array of exclude patterns. File paths matching these patterns will be excluded by the returned matcher. Defaults to files under <code>node_modules</code> found anywhere under root.</p> </li> </ul> </ul> </section> </div><div class='py1'><section class='py2 clearfix'> <h2 id='watermarks' class='mt0'> watermarks<span class='gray'></span> </h2> <p>returns the low and high watermarks to be used to designate whether coverage is <code>low</code>, <code>medium</code> or <code>high</code>. Statements, functions, branches and lines can have independent watermarks. These are respected by all reports that color for low, medium and high coverage. See the default configuration for exact syntax using <code>istanbul help config</code>. Used by the <code>cover</code> and <code>report</code> commands.</p> <h4>Returns</h4> <code><code><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">Object</a></code></code> : <span class='force-inline'> <p>an object containing low and high watermarks for statements, branches, functions and lines.</p> </span> </section> </div> </div> </div> </div> </div> <script src='assets/anchor.js'></script> <script src='assets/site.js'></script> </body> </html>