npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@heddendorp/cypress-plugin-multilanguage-coverage

v1.7.6

Published

This is a plugin for [cypress](https://www.cypress.io/) that allows you to generate a coverage report for your multilanguage project. Currently, there is support for frontend that runs in the browser and is tested by cypress. For the backend, there is

Downloads

38

Readme

cypress-plugin-multilanguage-coverage

This is a plugin for cypress that allows you to generate a coverage report for your multilanguage project.
Currently, there is support for frontend that runs in the browser and is tested by cypress. For the backend, there is support for java servers that are instrumented with jacoco.

Installation

npm install @heddendorp/cypress-plugin-multilanguage-coverage

You can find the releases of the package on GitHub.

After installing you have to add the following code to your cypress/plugins/index.ts file:

import { registerMultilanguageCoveragePlugin } from 'cypress-plugin-multilanguage-coverage';

registerMultilanguageCoveragePlugin()(on, config);

Usage

Java Instrumentation

You can instrument a java project with jacoco by running the following command in the root of your project:

java -javaagent:.\jars\jacocoagent.jar=output=tcpserver -jar .\jars\your.jar

For Artemis, you can use the following command:

java -javaagent:.\jars\jacocoagent.jar=output=tcpserver -jar .\build\libs\Artemis-6.0.0.jar --spring.profiles.active=dev,jenkins,gitlab,artemis,scheduling,local    

This is for a local setup with GitLab and Jenkins

For that you have to build the project first with

./gradlew spotlessApply -x webapp # to fix formatting issues
./gradlew build -x test -x jacocoTestCoverageVerification # to build the project without running tests

Configuration

You can configure the plugin by passing a config map to the registerMultilanguageCoveragePlugin function. The following options are available:

interface Config {
  /**
   * If enabled, the plugin will generate a JaCoCo coverage report for Java code.
   * @default true
   */
  enableJavaCoverage: boolean;
  /**
   * If enabled, the java coverage will be reset when the browser is launched.
   * @default true
   */
  resetCoverageOnSpecStart: boolean;
  /**
   * The path where JaCoCo files will be written to.
   * @default 'jacoco'
   */
  jaCoCoFilePath: string;
  /**
   * The path where the compiled frontend files are located.
   * @default '../../../build/resources/main/static'
   */
  frontendBuildLocation: string;
  /**
   * The path where the coverage report will be written to.
   * @default 'coverage'
   */
  coverageFolder: string;
  /**
   * Base path for this plugin.
   * @default __dirname
   */
  workingDirectory: string;
  /**
   * The path where the compiled Java classes are located.
   * @default '../../../build/classes'
   */
  javaClassesLocation: string;
  /**
   * The path where the Java source files are located.
   * @default '../../../src/main/java'
   */
  javaSourceLocation: string;
  /**
   * If enabled, the raw coverage data will be logged to a file.
   * @default false
   */
  saveRawCoverage: boolean;
  /**
   * If enabled, the coverage report will only be saved if the spec fails.
   * @default true
   */
  onlySaveOnFailure: boolean;
  /**
   * If enabled, the coverage folder will be deleted before the coverage report is generated.
   * @default true
   */
  cleanCoverageFolder: boolean;
  /**
   * The path to the Artemis distribution file.
   * If this is set, the plugin will extract it in place and use the extracted files for coverage.
   * @default '../../../build/libs/Artemis-6.0.0.war'
   */
  distributionFile: string;
}

It is recommended to set the workingDirectory to the root of your cypress project. This way, Your files don't end up in your node_modules folder.

{workingDirectory:path.join(__dirname, '..')}

Limitations

Currently coverage is only collected per file. In future versions of the plugin, more granular coverage could be a feature to support.

References