### Running JSCover Example with Ruby and RSpec Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-file-system/Readme.md Instructions to execute the JSCover example using Ruby and RSpec, covering file-system instrumentation, web server startup, and the command to run RSpec tests. ```Batch jscover-filesystem.bat web-server.bat ``` ```Shell jscover-filesystem.sh web-server.sh ``` ```Ruby rspec selenium-ide.rb ``` -------------------------------- ### Running JSCover Example with Selenium IDE Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-file-system/Readme.md Instructions to set up and run the JSCover example using Selenium IDE, including file-system instrumentation, web server startup, and test execution within the IDE. ```Batch jscover-filesystem.bat web-server.bat ``` ```Shell jscover-filesystem.sh web-server.sh ``` ```Selenium IDE Load selenium-ide.html in the Selenium IDE and run ``` -------------------------------- ### Sample Interactive Program Startup Notice Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/LICENSE.txt This snippet illustrates a short notice that an interactive program should output when it starts in interactive mode. It informs users about the program's version, copyright, lack of warranty, and free software status, directing them to commands for more details. ```Text Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. ``` -------------------------------- ### Standard GNU GPL License Notice for Source Files Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/LICENSE.txt This snippet provides the recommended text for a GNU General Public License (GPL) notice to be attached to the start of each source file of a new program. It includes copyright information, a statement of free software, and disclaimers of warranty, along with instructions on where to find the full license text. ```Text Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. ``` -------------------------------- ### Configure Sonatype Snapshot Repository for Maven Source: https://github.com/tntim96/jscover/blob/master/doc/downloads.html This XML snippet configures the Sonatype Nexus Snapshots repository in a Maven project's pom.xml. This is required to access the latest SNAPSHOT builds of JSCover. ```XML sonatype-nexus-snapshots Sonatype Nexus Snapshots https://oss.sonatype.org/content/repositories/snapshots true ``` -------------------------------- ### Configure Chrome for Local File Access Source: https://github.com/tntim96/jscover/blob/master/doc/faq.html To allow Google Chrome to load local files, such as JSCover reports or manuals, start the browser with the '--allow-file-access-from-files' switch. This resolves 'Cross-Origin Request Blocked' errors when accessing files directly from the file system. ```Shell google-chrome --allow-file-access-from-files ``` -------------------------------- ### Add JSCover Stable Release Dependency to Gradle Source: https://github.com/tntim96/jscover/blob/master/doc/downloads.html This string represents the dependency declaration for JSCover's stable release in a Gradle build script. It can be used in the dependencies block of build.gradle. ```Gradle 'com.github.tntim96:JSCover:2.0.21' ``` -------------------------------- ### Add JSCover Stable Release Dependency to Maven Source: https://github.com/tntim96/jscover/blob/master/doc/downloads.html This XML snippet adds the stable release of JSCover as a dependency to a Maven project's pom.xml file. It specifies the group ID, artifact ID, and version for the library. ```XML com.github.tntim96 JSCover 2.0.21 ``` -------------------------------- ### CSS Rules for Black and Red Divs Source: https://github.com/tntim96/jscover/blob/master/doc/example/index.html This CSS snippet defines two distinct styles for `div` elements using class selectors. The `div.black` rule sets the text color to black, while `div.red` sets the text color to red and applies a bold font weight. These rules can be applied to HTML `div` elements by assigning the respective class names. ```CSS div.black { color: black; } div.red { color: red; font-weight: bold; } ``` -------------------------------- ### JSCover Command-Line Options Reference Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/filesystem/help.txt Provides a comprehensive reference for all available command-line options in JSCover, detailing their purpose and usage for customizing JavaScript instrumentation and coverage data collection. ```APIDOC Options: --js-version=VERSION use the specified JavaScript version --no-instrument=PATH copy but do not instrument PATH --no-instrument-reg=URL do not instrument if URL matches regular expression --only-instrument-reg=URL only instrument if URL matches regular expression --exclude=PATH don't copy from source/PATH --exclude-reg=PATH don't copy from source/PATH if it matches regular expression --threads=NUMBER specify NUMBER of threads for performing instrumentation --no-branch turn off branch coverage data collection --no-function turn off function coverage data collection --local-storage save and load coverage data from HTML5 local storage --include-unloaded-js generate empty coverage data file to include unloaded JavaScript for later merging --isolate-browser prevent automatically combining coverage from different browser windows --detect-coalesce try to exclude coalesce assignments from conditional coverage --log=LEVEL set logging level to: SEVERE (default), WARNING, INFO, CONFIG, FINE, FINER, FINEST -h, --help display this help and exit ``` -------------------------------- ### Sample Copyright Disclaimer for Programs Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/LICENSE.txt This snippet provides a template for a copyright disclaimer, which an employer or school might sign to disclaim copyright interest in a program developed by an employee or student. It includes placeholders for the organization, program name, author, and signatory details. ```Text Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice ``` -------------------------------- ### JSCover Command-Line Instrumentation Usage Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/filesystem/help.txt Demonstrates the basic command-line syntax for using JSCover to instrument JavaScript files, specifying source and destination directories for the instrumentation process. ```Shell java -jar JSCover-all.jar -fs [OPTION]... SOURCE-DIRECTORY DESTINATION-DIRECTORY ``` -------------------------------- ### JSCover Server Usage and Configuration Options Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/server/help.txt This section outlines the command-line arguments and options available when running JSCover-all.jar in server mode, allowing users to configure content serving, instrumentation behavior, reporting directories, network ports, and advanced coverage features. ```APIDOC Usage: java -jar JSCover-all.jar -ws [OPTION]... Run a server for instrumenting JavaScript with code coverage information. Options: --document-root=DIR serve content from DIR (default: current directory) --no-instrument=URL do not instrument URL --no-instrument-reg=URL do not instrument if URL matches regular expression --only-instrument-reg=URL only instrument if URL matches regular expression --report-dir=DIR store report to DIR (default: current directory) --port=PORT use PORT for TCP port (default: 8080) --proxy run as a proxy --save-json-only save only the coverage data, jscoverage.json --uri-to-file-matcher=REG for proxy mode, regular expression matcher for converting a URI to a file path --uri-to-file-replace=REP for proxy mode, regular expression replacement for converting a URI to a file path --js-version=VERSION JavaScript version ECMASCRIPT3/5/6/7/8 (default: ECMASCRIPT8) --no-branch turn off branch coverage data collection --no-function turn off function coverage data collection --include-unloaded-js include unloaded JavaScript under in the report --local-storage save and load coverage data from HTML5 local storage --isolate-browser prevent automatically combining coverage from different browser windows --detect-coalesce try to exclude coalesce assignments from conditional coverage --log=LEVEL set logging level to: SEVERE (default), WARNING, INFO, CONFIG, FINE, FINER, FINEST -h, --help display this help and exit ``` -------------------------------- ### JSCover CLI Basic Usage Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/stdout/help.txt Demonstrates the basic command-line syntax for running JSCover-all.jar to instrument a JavaScript source file. It shows the `java -jar` invocation with input/output options. ```Shell java -jar JSCover-all.jar -io [OPTION]... SOURCE-FILE ``` -------------------------------- ### JSCover Command-Line Options Reference Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/help.txt A comprehensive reference for the command-line options available in the JSCover tool. It covers different instrumentation modes, report generation, regular expression testing, and general help/version information. ```APIDOC JSCover Command-Line Interface: Usage: java -jar jscover.jar [OPTION]... To see sub-command options run: java -jar JSCover-all.jar [-ws|-fs|-io] -h Options: -ws instrument via the web-server -fs instrument via the file-system -io instrument single file to stdout -gf [SRC] DEST generate JSCover report files -regex-test REGEX STRING test a regular expression -h, --help display this help and exit -h encoding list available encodings -V, --version display version information and exit ``` -------------------------------- ### Generate Dynamic Download Link for JSCover Source: https://github.com/tntim96/jscover/blob/master/bookmarks.html This JavaScript snippet dynamically constructs a URL for the JSCover project's download statistics page on SourceForge. It calculates the current date to set the end date for the statistics range and then updates an HTML element with an 'All Downloads' link. ```JavaScript var now = new Date(); link = "https://sourceforge.net/projects/jscover/files/stats/map?dates=2012-12-01+to+"; link += now.getFullYear() + "-" + (now.getMonth()+1) + "-" + now.getDate(); document.getElementById('allDownloads').innerHTML = 'All Downloads
'; ``` -------------------------------- ### Automated Web Interaction Script using Selenium IDE Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-proxy/selenium-ide-proxy.html This Selenium IDE script outlines a series of automated steps to interact with a web application. It demonstrates opening URLs, clicking elements by ID, waiting for specific text content to appear, waiting for elements to be present using XPath, and managing browser local storage. This script is suitable for functional testing or demonstrating basic web automation flows. ```Selenium IDE open /index.html click id=radio1 open /index.html click id=radio2 open /jscoverage.html click id=storeTab waitForText id=progressLabel Done click id=storeButton waitForElementPresent //div[@id='storeDiv' and contains(.,'Coverage data stored')] open /jscoverage-clear-local-storage.html waitForText id=deleteLocalStorage Deleted localStorage['jscover'] open /stop ``` -------------------------------- ### Configuring Coverage Report Saving and Display Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-file-system/Readme.md Details on modifying selenium-ide.html and jscoverage.js to save coverage JSON to a specific path and enable its loading for display within the coverage results. ```Instructions 1. Save the coverage JSON to 'target/example-fs-localStorage/jscoverage.json' 2. Append 'jscoverage_isReport = true;' to jscoverage.js so it will load the JSON above and display the coverage results ``` -------------------------------- ### JSCover Command Line Options Reference Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/stdout/help.txt Provides a detailed reference for the command-line options available with JSCover-all.jar. These options control aspects like JavaScript version, type of coverage data collected (branch, function), storage mechanisms, browser isolation, assignment detection, and logging levels. ```APIDOC Options: --js-version=VERSION use the specified JavaScript version --no-branch turn off branch coverage data collection --no-function turn off function coverage data collection --local-storage save and load coverage data from HTML5 local storage --isolate-browser prevent automatically combining coverage from different browser windows --detect-coalesce try to exclude coalesce assignments from conditional coverage --log=LEVEL set logging level to: SEVERE (default), WARNING, INFO, CONFIG, FINE, FINER, FINEST -h, --help display this help and exit ``` -------------------------------- ### Automating Web Interactions and Coverage Collection with Selenium IDE Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-file-system/selenium-ide.html This Selenium IDE script performs a sequence of actions including opening web pages, clicking radio buttons, and executing an inline JavaScript function to retrieve code coverage information. The collected coverage data is then echoed, and a summary tab is clicked, typically used in a testing or coverage analysis workflow. ```Selenium IDE Script open /index.html click id=radio1 open /index.html click id=radio2 open /jscoverage.html execute script window.jscoverage_serializeCoverageToJSON() coverageJSON echo ${coverageJSON} click id=summaryTab ``` ```JavaScript window.jscoverage_serializeCoverageToJSON() ``` -------------------------------- ### Run Pre-Commit Checks for JSCover Development Source: https://github.com/tntim96/jscover/blob/master/README.md Before checking in any changes to the JSCover project, developers should run this Ant command. It executes the full build and test suite, and enforces coverage limits on combined unit, integration, and acceptance tests. ```Ant ant pre-commit ``` -------------------------------- ### Selenium IDE Script for JSCover UI Testing Workflow Source: https://github.com/tntim96/jscover/blob/master/examples/localStorage-server/selenium-ide.html This script automates a series of actions in a web browser using Selenium IDE. It navigates to different pages, interacts with radio buttons, manages coverage data storage, waits for specific text and elements, and clears local storage. It's designed to test the UI flow and data persistence of a JSCover application. ```Selenium IDE open /index.html click id=radio1 open /index.html click id=radio2 open /jscoverage.html click id=storeTab waitForText id=progressLabel Done click id=storeButton waitForElementPresent //div[@id='storeDiv' and contains(.,'Coverage data stored')] open /jscoverage-clear-local-storage.html waitForText id=deleteLocalStorage Deleted localStorage['jscover'] open /stop ``` -------------------------------- ### JSCover Report Generation and Merging CLI Usage Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscover/report/help.txt Command-line interface for the JSCover report tool, including options for converting coverage data to various formats (XMLSUMMARY, LCOV, COBERTURAXML) and merging multiple report directories. The `REPORT-DIR` specifies the input directory containing `jscoverage.json`, and `SRC-DIRECTORY` is required for LCOV and Cobertura XML formats to locate source files. The `--merge` option combines multiple report directories into a single `DEST-DIR`. ```Shell java -cp JSCover-all.jar jscover.report.Main --format=XMLSUMMARY REPORT-DIR or java -cp JSCover-all.jar jscover.report.Main --format=[ LCOV | COBERTURAXML ] REPORT-DIR SRC-DIRECTORY or java -cp JSCover-all.jar jscover.report.Main --merge REPORT-DIR1 REPORT-DIR2... DEST-DIR ``` ```APIDOC Options: -h, --help display this help and exit --format=XMLSUMMARY output XML summary to REPORT-DIR/jscover-summary.xml --format=LCOV output LCOV data to REPORT-DIR/jscover.lcov with source at SRC-DIRECTORY --format=COBERTURAXML output cobertura data to REPORT-DIR/cobertura-coverage.xml with source at SRC-DIRECTORY --merge merge specified report directories to the specified directory ``` -------------------------------- ### CSS Styling for Div Elements Source: https://github.com/tntim96/jscover/blob/master/src/test-acceptance/resources/example/index.html This snippet demonstrates basic CSS rules for styling div elements. It defines two classes, 'black' for black text and 'red' for bold red text, showcasing how to apply different styles based on class names. ```CSS div.black { color: black; } div.red { color: red; font-weight: bold; } ``` -------------------------------- ### Configure Firefox for Local File Access Source: https://github.com/tntim96/jscover/blob/master/doc/faq.html To enable Firefox to load local files, such as JSCover reports or manuals, modify specific preferences in 'about:config'. This involves changing 'privacy.file_unique_origin' to 'false' and, for Firefox versions 106+, setting 'security.fileuri.strict_origin_policy' to 'false'. ```Browser Configuration privacy.file_unique_origin: false security.fileuri.strict_origin_policy: false (Firefox > 106) ``` -------------------------------- ### Clear JSCover Data from Local Storage Source: https://github.com/tntim96/jscover/blob/master/src/main/resources/jscoverage-clear-local-storage.html This JavaScript function removes the 'jscover' item from the browser's local storage. It also updates a specific HTML `` element with the text 'Deleted localStorage['jscover']' to indicate the action has been performed. This function is typically used for cleanup or resetting JSCover-related data. ```JavaScript function clearLocalStorage() { localStorage.removeItem('jscover'); var span = document.getElementById("deleteLocalStorage"); span.appendChild(document.createTextNode("Deleted localStorage['jscover']")); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.