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

@jenkins-cd/js-builder-jest

v0.0.4

Published

Adds support for running tests with Jest via Jenkins js-builder

Downloads

1,431

Readme

Jest support for Jenkins JS Builder

Run your tests with Jenkins JS Builder using the "Jest" test runner.

Setup

  1. Add a gulpfile with the following line:

    const jsb = require('@jenkins-cd/js-builder');

  2. Install the @jenkins-cd/js-builder-jest dependency.

  3. Setup npm scripts

    It is convenient to invoke js-builder-jest via npm scripts. Add the following to the "scripts" block in package.json:

    "test": "gulp test",
    "test:fast": "gulp test:fast",
    "test:debug": "node --debug-brk ./node_modules/.bin/gulp test:debug",

Defaults

The default location for tests is the test folder. This can be overridden by calling builder.tests(<new-path> in the gulpfile.

The file names need to match the pattern *-spec.js or *-test.js; the jsx extension is also supported.

'test' Task

Run the tests and produces test and coverage reports.

You can limit the tests that are run via the test parameter. This is a pattern that is passed to Jest's testPathPattern CLI parameter.

JUnit test reports are stored in target/jest-reports/ and coverage reports in target/jest-coverage/. Note that coverage is only measured for .js and .jsx files in the source directories (default: src).

'test:fast" Task

npm run test:fast

Runs the tests but skips generation of reports and coverage. This is good for local development.

'test:debug' Task

npm run test:debug

Runs the tests in debug mode on default port 5858. Test execution will be paused until the debugger is attached and execution is resumed.

Running specific tests

Run a single test.

npm run test -- --test test/src/js/foo/bar/foobar-spec

Runs any test with 'calculator' in the path or name.

npm run test -- --test calculator

Run any test inside of a 'math' folder.

npm run test -- --test /math/

Using custom configuration

Jest configuration

Jest's command line runner supports custom configuration placed in a "jest" property in package.json. js-builder-jest will automatically add these configuration options if they are defined.

Jest CLI Options

Jest also supports useful CLI options. These can be used in two ways:

In npm scripts

"test:fast": "gulp test:fast --updateSnapshot",

From command line

npm run test:fast -- --updateSnapshot

Note the double dash above.