New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@jenkins-cd/js-builder-jest

Package Overview
Dependencies
Maintainers
11
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jenkins-cd/js-builder-jest

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

  • 0.0.4
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
414
increased by38.93%
Maintainers
11
Weekly downloads
 
Created
Source

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.

FAQs

Package last updated on 16 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc