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.3.2 to 2.4.0

25

dist/index.js

@@ -152,14 +152,2 @@ "use strict";

});
var moduleNames = [
{
name: 'react',
type: 'file',
location: 'node_modules/react/umd/react.development.js'
},
{
name: 'react-dom',
type: 'file',
location: 'node_modules/react-dom/umd/react-dom.development.js'
}
];
/*

@@ -173,2 +161,15 @@ Before All

before(function () {
var settings = Cypress.env('cypress-react-unit-test') || {};
var moduleNames = [
{
name: 'react',
type: 'file',
location: settings.react || 'node_modules/react/umd/react.development.js'
},
{
name: 'react-dom',
type: 'file',
location: settings['react-dom'] || 'node_modules/react-dom/umd/react-dom.development.js'
}
];
Cypress.modules = [];

@@ -175,0 +176,0 @@ cy.log('Initializing UMD module cache').then(function () {

@@ -169,15 +169,2 @@ /// <reference path="./index.d.ts" />

const moduleNames = [
{
name: 'react',
type: 'file',
location: 'node_modules/react/umd/react.development.js'
},
{
name: 'react-dom',
type: 'file',
location: 'node_modules/react-dom/umd/react-dom.development.js'
}
]
/*

@@ -191,2 +178,17 @@ Before All

before(() => {
const settings = Cypress.env('cypress-react-unit-test') || {}
const moduleNames = [
{
name: 'react',
type: 'file',
location: settings.react || 'node_modules/react/umd/react.development.js'
},
{
name: 'react-dom',
type: 'file',
location: settings['react-dom'] || 'node_modules/react-dom/umd/react-dom.development.js'
}
]
Cypress.modules = []

@@ -193,0 +195,0 @@ cy.log('Initializing UMD module cache').then(() => {

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

@@ -12,3 +12,4 @@ "main": "dist",

"transpile": "tsc",
"pretest": "npm run lint",
"watch": "tsc -w",
"pretest": "npm run lint && npm run transpile",
"lint": "standard --verbose --fix *.js src cypress/integration",

@@ -32,20 +33,20 @@ "semantic-release": "semantic-action pre && npm run transpile && npm publish && semantic-action post"

"devDependencies": {
"@babel/core": "7.3.3",
"@babel/plugin-proposal-class-properties": "7.3.3",
"@babel/preset-env": "7.3.1",
"@babel/core": "7.3.4",
"@babel/plugin-proposal-class-properties": "7.3.4",
"@babel/preset-env": "7.3.4",
"@babel/preset-react": "7.0.0",
"@cypress/webpack-preprocessor": "1.1.3",
"@types/node": "9.6.42",
"@types/node": "9.6.46",
"axios": "0.18.0",
"babel-loader": "8.0.5",
"css-loader": "2.1.0",
"cypress": "3.1.5",
"css-loader": "2.1.1",
"cypress": "3.2.0",
"github-post-release": "1.13.1",
"react": "16.8.2",
"react-dom": "16.8.2",
"react": "16.8.4",
"react-dom": "16.8.4",
"semantic-action": "1.1.6",
"standard": "11.0.1",
"standard": "12.0.1",
"style-loader": "0.23.1",
"typescript": "2.9.2",
"webpack": "4.29.4"
"typescript": "3.3.3333",
"webpack": "4.29.6"
},

@@ -52,0 +53,0 @@ "standard": {

@@ -25,5 +25,19 @@ # 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]

If you need help configuring bundler, see [preprocessors info](https://gitpitch.com/cypress-io/testing-workshop-cypress?p=slides/16-preprocessors)
## Use
Include this plugin from `cypress/support/index.js`
```js
import 'cypress-react-unit-test'
```
This adds a new command `cy.mount` that can mount a React component. It also overloads `cy.get` to accept in addition to selectors React component, returning it. See examples below.
## Example
```js
// load Cypress TypeScript definitions for IntelliSense
/// <reference types="cypress" />
// import the component you want to test

@@ -53,2 +67,17 @@ import { HelloState } from '../../src/hello-x.jsx'

## Configuration
If your React and React DOM libraries are installed in non-standard paths (think monorepo scenario), you can tell this plugin where to find them. In `cypress.json` specify paths like this:
```json
{
"env": {
"cypress-react-unit-test": {
"react": "node_modules/react/umd/react.development.js",
"react-dom": "node_modules/react-dom/umd/react-dom.development.js"
}
}
}
```
## Transpilation

@@ -129,2 +158,8 @@

## Development
- run TypeScript compiler in watch mode with `npx tsc -w`
- run Cypress with `npx cypress open` and select the spec you want to work with
- edit `lib/index.ts` where all the magic happens
## Related tools

@@ -131,0 +166,0 @@

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