@pactflow/pact-cypress-adapter
Advanced tools
Comparing version 1.2.6 to 1.3.0
@@ -32,3 +32,4 @@ "use strict"; | ||
var formattedAlias = (0, utils_1.formatAlias)(alias); | ||
var testCaseTitle = Cypress.currentTest.title; | ||
// Cypress versions older than 8.2 do not have a currentTest objects | ||
var testCaseTitle = Cypress.currentTest ? Cypress.currentTest.title : ''; | ||
//NOTE: spread only works for array containing more than one item | ||
@@ -66,3 +67,4 @@ if (formattedAlias.length > 1) { | ||
var formattedAlias = (0, utils_1.formatAlias)(alias); | ||
var testCaseTitle = Cypress.currentTest.title; | ||
// Cypress versions older than 8.2 do not have a currentTest objects | ||
var testCaseTitle = Cypress.currentTest ? Cypress.currentTest.title : ''; | ||
formattedAlias.forEach(function (alias) { | ||
@@ -69,0 +71,0 @@ cy.get(alias).then(function (response) { |
@@ -61,2 +61,3 @@ "use strict"; | ||
var lodash_1 = require("lodash"); | ||
var pjson = require('../package.json'); | ||
var formatAlias = function (alias) { | ||
@@ -129,2 +130,6 @@ if (Array.isArray(alias)) { | ||
version: '2.0.0' | ||
}, | ||
client: { | ||
name: 'pact-cypress-adapter', | ||
version: pjson.version | ||
} | ||
@@ -131,0 +136,0 @@ } |
{ | ||
"name": "@pactflow/pact-cypress-adapter", | ||
"version": "1.2.6", | ||
"version": "1.3.0", | ||
"description": "A cypress adapter for pact", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
# Pact Cypress Adapter | ||
Generate pact contracts from cypress test. | ||
[![Build and test](https://github.com/pactflow/cypress-pact-adapter/actions/workflows/test-and-build.yaml/badge.svg)](https://github.com/pactflow/cypress-pact-adapter/actions/workflows/test-and-build.yaml) [![npm version](https://badge.fury.io/js/@pactflow%2Fpact-cypress-adapter.svg)](https://badge.fury.io/js/@pactflow%2Fpact-cypress-adapter) | ||
Generate Pact contracts from your existing Cypress tests. | ||
> Accelerate your entry into contract testing with the Cypress development experience you know and love. — With Pact Cypress Adapter you can get the extra layer of testing safety, easily using existing mocks you’ve created with Cypress. | ||
> | ||
> Read our [blog post](https://pactflow.io/blog/use-cypress-in-contract-testing/) to find out more, otherwise dive-right in. | ||
## Installation | ||
- NPM: | ||
**NPM**: | ||
```bash | ||
@@ -10,3 +16,3 @@ npm i -D @pactflow/pact-cypress-adapter | ||
- yarn: | ||
**yarn**: | ||
```bash | ||
@@ -92,2 +98,3 @@ yarn add -D @pactflow/pact-cypress-adapter | ||
**Example** | ||
```js | ||
@@ -110,2 +117,6 @@ before(() => { | ||
Convenience wrapper for `cy.request(options).as(alias)` | ||
- Accepts a valid Cypress request options argument [Cypress request options argument](https://docs.cypress.io/api/commands/request#Arguments) | ||
**Example** | ||
@@ -116,3 +127,9 @@ ```js | ||
cy.setupPact('ui-consumer', 'api-provider') | ||
cy.usePactRequest('GET', '/users').as('getAllUsers') | ||
cy.usePactRequest( | ||
{ | ||
method: 'GET', | ||
url: '/users', | ||
}, | ||
'getAllUsers' | ||
) | ||
}) | ||
@@ -119,0 +136,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
20924
324
144