JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 14
  • Score
    100M100P100Q47020F
  • License MIT

Cypress plugin for Spring Contract Stubs

Package Exports

  • cypress-contract-stubs

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cypress-contract-stubs) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Cypress Contract Stubs

Npm Github Action Jest Codecov

The cypress-contract-stubs adds support for using Spring Cloud Contract Stub entries when testing with Cypress.

Get started

Installation

Install the plugin by running:

npm install --save-dev cypress-contract-stubs

Cypress Configuration

Add it to your plugin file:

cypress/plugins/index.js

const { contractStubsPlugin } = require('cypress-contract-stubs');

module.exports = (on, config) => {
  contractStubsPlugin(on, config);
}

Add configuration for remote or local stubs to your Cypress configuration.

cypress.json

{
  "env": {
    "stubs": [
      {
        "mode": "remote",
        "id": "internal.contracts:artifact-name:+:stubs",
        "server": "http://nexus3.proxy.internal",
        "repository": "maven-releases"
      },
      {
        "mode": "local",
        "file": "artifact-name-1.318-SNAPSHOT-stubs.jar"
      }
    ]
  }
}

Use cy commands

Add it to your support file:

cypress/support/index.js

import 'cypress-contract-stubs/commands';

In your test files, will be available the following commands:

  • cy.contractStubs Get all available stub entries
  • cy.contractStub Get stub entry by options
cy.contractStubs().then((stubs) => console.log(stubs));
cy.contractStub({ name: 'stubName' }).then((stub) => console.log(stub));

License

cypress-contract-stubs is MIT licensed.