Socket
Socket
Sign inDemoInstall

cypress-react-unit-test

Package Overview
Dependencies
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cypress-react-unit-test - npm Package Compare versions

Comparing version 2.4.3 to 2.5.0

2

dist/getDisplayName.js

@@ -17,3 +17,3 @@ "use strict";

}
var displayName;
var displayName = null;
// The displayName property is not guaranteed to be a string.

@@ -20,0 +20,0 @@ // It's only safe to use for our purposes if it's a string.

@@ -81,3 +81,3 @@ "use strict";

* @param {Object} jsx - component to mount
* @param {string} [Component] - alias to use later
* @param {string} alias [Component] - alias to use later
* @example

@@ -84,0 +84,0 @@ ```

@@ -18,3 +18,3 @@ /// <reference path="./index.d.ts" />

let displayName: string
let displayName: string | null = null;

@@ -21,0 +21,0 @@ // The displayName property is not guaranteed to be a string.

@@ -22,2 +22,7 @@ // I hope to get types and docs from functions imported from ./index one day

interface JSXElement {
type: JSX
props: object
}
declare namespace Cypress {

@@ -35,5 +40,5 @@ interface Cypress {

interface Chainable<Subject> {
state: (key) => any,
state: (key: any) => any,
injectReactDOM: () => Chainable<void>
copyComponentStyles: (component: Symbol) => Chainable<void>
copyComponentStyles: (component: JSXElement) => Chainable<void>
/**

@@ -58,5 +63,5 @@ * Mount a React component in a blank document; register it as an alias

**/
mount: (component: Symbol, alias?: string) => Chainable<void>
mount: (component: JSXElement, alias?: string) => Chainable<void>
get<S = any>(alias: string | symbol | Function, options?: Partial<Loggable & Timeoutable>): Chainable<any>
}
}

@@ -9,3 +9,3 @@ /// <reference path="./index.d.ts" />

const setXMLHttpRequest = w => {
const setXMLHttpRequest = (w: Window) => {
// by grabbing the XMLHttpRequest from app's iframe

@@ -19,3 +19,3 @@ // and putting it here - in the test iframe

const setAlert = w => {
const setAlert = (w: Window) => {
window.alert = w.alert

@@ -66,8 +66,8 @@ return w

// @ts-ignore
const specDocument = parentDocument.querySelector('iframe.spec-iframe').contentDocument
const specDocument: Element = parentDocument.querySelector('iframe.spec-iframe').contentDocument
// @ts-ignore
const appDocument = parentDocument.querySelector('iframe.aut-iframe').contentDocument
const appDocument: Element = parentDocument.querySelector('iframe.aut-iframe').contentDocument
const hash = component.type.name
let styles = specDocument.querySelectorAll('head style')
let styles: NodeListOf<Element> | null = specDocument.querySelectorAll('head style')
if (styles.length) {

@@ -87,3 +87,3 @@ cy.log(`injected ${styles.length} style(s)`)

}
const head = appDocument.querySelector('head')
const head = appDocument.querySelector('head')!
styles.forEach(function (style) {

@@ -99,3 +99,3 @@ head.appendChild(style)

* @param {Object} jsx - component to mount
* @param {string} [Component] - alias to use later
* @param {string} alias [Component] - alias to use later
* @example

@@ -114,7 +114,7 @@ ```

**/
export const mount = (jsx, alias) => {
export const mount = (jsx: JSXElement, alias?: string) => {
// Get the display name property via the component constructor
const displayname = getDisplayName(jsx.type, alias)
let cmd
let cmd: Cypress.Log;

@@ -138,3 +138,3 @@ cy.injectReactDOM()

.then(win => {
const { ReactDOM } = win
const { ReactDOM } = win as Window & {ReactDOM: any}
const document = cy.state('document')

@@ -141,0 +141,0 @@ const component = ReactDOM.render(

{
"name": "cypress-react-unit-test",
"version": "2.4.3",
"version": "2.5.0",
"description": "Unit test React components using Cypress",

@@ -16,3 +16,3 @@ "main": "dist",

"lint": "standard --verbose --fix *.js src cypress/integration",
"semantic-release": "semantic-action pre && npm run transpile && npm publish && semantic-action post"
"semantic-release": "semantic-release"
},

@@ -44,11 +44,11 @@ "files": [

"css-loader": "2.1.1",
"cypress": "3.3.1",
"github-post-release": "1.13.1",
"cypress": "4.3.0",
"react": "16.8.6",
"react-dom": "16.8.6",
"semantic-action": "1.1.6",
"standard": "12.0.1",
"style-loader": "0.23.1",
"typescript": "3.5.1",
"webpack": "4.33.0"
"webpack": "4.33.0",
"webpack-cli": "3.3.9",
"semantic-release": "^17.0.4"
},

@@ -65,7 +65,3 @@ "standard": {

"url": "https://github.com/bahmutov/cypress-react-unit-test.git"
},
"release": {
"analyzeCommits": "simple-commit-message",
"generateNotes": "github-post-release"
}
}

@@ -1,2 +0,2 @@

# cypress-react-unit-test [![Build Status](https://travis-ci.org/bahmutov/cypress-react-unit-test.svg?branch=master)](https://travis-ci.org/bahmutov/cypress-react-unit-test) [![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://dashboard.cypress.io/#/projects/z9dxah) [![renovate-app badge][renovate-badge]][renovate-app] [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/bahmutov/cypress-react-unit-test)
# cypress-react-unit-test [![CircleCI](https://circleci.com/gh/bahmutov/cypress-react-unit-test/tree/master.svg?style=svg)](https://circleci.com/gh/bahmutov/cypress-react-unit-test/tree/master) [![Cypress.io tests](https://img.shields.io/badge/cypress.io-tests-green.svg?style=flat-square)](https://dashboard.cypress.io/#/projects/z9dxah) [![renovate-app badge][renovate-badge]][renovate-app] [![This project is using Percy.io for visual regression testing.](https://percy.io/static/images/percy-badge.svg)](https://percy.io/bahmutov/cypress-react-unit-test)

@@ -158,2 +158,10 @@ > A little helper to unit test React components in the open source [Cypress.io](https://www.cypress.io/) E2E test runner **ALPHA**

To get started with this repo, compile the plugin's code and the examples code
```shell
npm run transpile
npm run build
npm run cy:open
```
- run TypeScript compiler in watch mode with `npx tsc -w`

@@ -160,0 +168,0 @@ - run Cypress with `npx cypress open` and select the spec you want to work with

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