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

@helpscout/cyan

Package Overview
Dependencies
Maintainers
6
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helpscout/cyan - npm Package Compare versions

Comparing version 0.7.0 to 0.8.0

dist/cleanUp.d.ts

10

dist/commands/debugger.commands.js

@@ -10,12 +10,6 @@ "use strict";

function debug() {
var _console;
function debug(options) {
var node = this.__getNode('debug');
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
(_console = console).log.apply(_console, [(0, _pretty.pretty)(node.outerHTML)].concat(args));
console.log((0, _pretty.pretty)(node.outerHTML, options));
}

@@ -22,0 +16,0 @@

3

dist/cy.js

@@ -16,2 +16,4 @@ "use strict";

var _domCleanUp = _interopRequireDefault(require("./domCleanUp"));
var _debug = _interopRequireDefault(require("./debug"));

@@ -51,2 +53,3 @@

cleanUp: _cleanUp.default,
domCleanUp: _domCleanUp.default,
debug: _debug.default,

@@ -53,0 +56,0 @@ delay: _delay.default,

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

});
exports.default = exports.Cyan = void 0;
exports.default = void 0;

@@ -23,3 +23,8 @@ var _invariant = _interopRequireDefault(require("invariant"));

function Cyan(el) {
this.get(el);
this.el = [];
this.length = 0;
if (el) {
this.get(el);
}
} // QuerySelectors

@@ -74,5 +79,4 @@

exports.Cyan = Cyan;
(0, _command.addCommands)(Cyan, _commands.default);
(0, _command.withCommands)(_commands.default)(Cyan);
var _default = Cyan;
exports.default = _default;

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

declare const debug: (selector: string, options: any) => void;
declare const debug: (selector?: string | undefined, options?: any) => void;
export default debug;
import cy from './cy';
export { default as cy } from './cy';
export { default as cleanUp } from './cleanUp';
export { default as domCleanUp } from './domCleanUp';
export { default as debug } from './debug';

@@ -5,0 +6,0 @@ export { default as fireEvent } from './fireEvent';

@@ -9,2 +9,3 @@ "use strict";

cleanUp: true,
domCleanUp: true,
debug: true,

@@ -28,2 +29,8 @@ fireEvent: true,

});
Object.defineProperty(exports, "domCleanUp", {
enumerable: true,
get: function get() {
return _domCleanUp.default;
}
});
Object.defineProperty(exports, "debug", {

@@ -65,2 +72,4 @@ enumerable: true,

var _domCleanUp = _interopRequireDefault(require("./domCleanUp"));
var _debug = _interopRequireDefault(require("./debug"));

@@ -67,0 +76,0 @@

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

declare class RenderWrapper {
import Cyan from '../cyan';
declare class RenderWrapper extends Cyan {
Component: any;

@@ -7,2 +8,3 @@ WrappedComponent: any;

constructor(Component: any);
setRootNode(): void;
setComponent(Component: any): void;

@@ -12,4 +14,2 @@ mount(Component?: any): this;

setProp(prop: any, value: any): this;
debug(): this;
html(): string;
cleanUp(): this;

@@ -16,0 +16,0 @@ unmount(): this;

@@ -12,2 +12,4 @@ "use strict";

var _cyan = _interopRequireDefault(require("../cyan"));
var _cleanUp2 = _interopRequireDefault(require("../cleanUp"));

@@ -17,4 +19,2 @@

var _debug2 = _interopRequireDefault(require("../debug"));
var _timers = require("../timers");

@@ -32,9 +32,23 @@

function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; subClass.__proto__ = superClass; }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var RenderWrapper =
/*#__PURE__*/
function () {
function (_Cyan) {
_inheritsLoose(RenderWrapper, _Cyan);
function RenderWrapper(Component) {
this.setComponent(Component);
this.mount(Component);
return this;
var _this = _Cyan.call(this) || this;
_this.setComponent(Component);
_this.mount(Component); // .get() method comes from Cyan
// @ts-ignore
_this.get(_this.root.children[0]);
return _assertThisInitialized(_assertThisInitialized(_this)) || _assertThisInitialized(_this);
}

@@ -44,2 +58,9 @@

_proto.setRootNode = function setRootNode() {
this.cleanUp(); // Create the root node for ReactDOM to mount to
this.root = (0, _render.createRootNode)();
document.body.appendChild(this.root);
};
_proto.setComponent = function setComponent(Component) {

@@ -55,8 +76,5 @@ this.Component = Component && Component.type ? React.createElement(Component.type, null) : null;

this.cleanUp();
this.setComponent(Component); // Create the root node for ReactDOM to mount to
this.setComponent(Component);
this.setRootNode(); // Render the WrappedComponent into the root node
this.root = (0, _render.createRootNode)();
document.body.appendChild(this.root); // Render the WrappedComponent into the root node
this.WrappedComponent = (0, _wrapWithProvider.default)(this.Component);

@@ -88,11 +106,2 @@ (0, _timers.runAllTimers)();

_proto.debug = function debug() {
(0, _debug2.default)();
return this;
};
_proto.html = function html() {
return (0, _render.getDocumentHTML)();
};
_proto.cleanUp = function cleanUp() {

@@ -118,5 +127,5 @@ (0, _cleanUp2.default)();

return RenderWrapper;
}();
}(_cyan.default);
var _default = RenderWrapper;
exports.default = _default;

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

var wrapWithProvider = function (WrappedComponent) {
function wrapWithProvider(WrappedComponent) {
var store = (0, _store.getStore)();

@@ -46,5 +46,5 @@

return WrappedWithProvider;
};
}
var _default = wrapWithProvider;
exports.default = _default;

@@ -1,3 +0,3 @@

import Cyan, { Selector, CySelector } from './Cyan.types';
import RenderWrapper from './RenderWrapper.types';
import CyanInterface, { Selector, CySelector } from './Cyan.interface.types';
import RenderWrapperInterface from './RenderWrapper.interface.types';
export declare type Cy = {

@@ -12,4 +12,14 @@ /**

*/
get(selector: Selector): Cyan;
get(selector: Selector): CyanInterface;
/**
* Use cy.get() instead!
* Get the DOM elements with a selector.
*
* @returns {Cyan} The Cyan instance.
*
* @example
* cy.find('ul')
*/
find(selector: Selector): CyanInterface;
/**
* Get the DOM elements with a [data-cy] selector.

@@ -22,3 +32,3 @@ *

*/
getByCy(selector: CySelector): Cyan;
getByCy(selector: CySelector): CyanInterface;
/**

@@ -32,3 +42,3 @@ * Get the DOM elements with a text match.

*/
getByText(text: string): Cyan;
getByText(text: string): CyanInterface;
/**

@@ -38,3 +48,3 @@ * Renders the Component into the DOM.

* @param {any} Component The Component to render.
* @returns {RenderWrapper} The RenderWrapper instance.
* @returns {CyanInterface} The Cyan instance.
*

@@ -44,5 +54,5 @@ * @example

*/
render(component: any): RenderWrapper;
render(component: any): RenderWrapperInterface;
/**
* Unmounts the rendered React component and resets the document.body.
* Unmounts the rendered React component.
*

@@ -54,2 +64,9 @@ * @example

/**
* Resets the document.body.
*
* @example
* cy.domCleanUp()
*/
domCleanUp(): void;
/**
* Logs the html of document.body.

@@ -56,0 +73,0 @@ *

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

export declare const addCommands: (baseClass: any, commandList: any) => void;
export declare const withCommands: (commandList: any) => (baseClass: any) => any;
export declare const combineCommands: (commandList: any) => any;

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

});
exports.combineCommands = exports.addCommands = void 0;
exports.combineCommands = exports.withCommands = void 0;

@@ -13,10 +13,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }

var addCommands = function (baseClass, commandList) {
var commands = Object.keys(commandList);
commands.forEach(function (key) {
baseClass.prototype[key] = commandList[key];
});
var withCommands = function (commandList) {
return function (baseClass) {
var commands = Object.keys(commandList);
commands.forEach(function (key) {
baseClass.prototype[key] = commandList[key];
});
return baseClass;
};
};
exports.addCommands = addCommands;
exports.withCommands = withCommands;

@@ -23,0 +26,0 @@ var combineCommands = function (commandList) {

@@ -6,33 +6,33 @@ "use strict";

});
exports.isNodeCollection = exports.isElement = exports.isNode = exports.isNodeList = exports.isHTMLCollection = exports.isString = exports.isObject = exports.isFunction = exports.isArray = exports.isDefined = void 0;
var isDefined = function (obj) {
return obj !== null && obj !== undefined;
};
exports.isDefined = isDefined;
var isArray = function (obj) {
return Array.isArray(obj);
};
exports.typeOf = typeOf;
exports.isArray = isArray;
exports.isFunction = isFunction;
exports.isString = isString;
exports.isObject = isObject;
exports.isNodeCollection = exports.isElement = exports.isNode = exports.isNodeList = exports.isHTMLCollection = void 0;
var isFunction = function (obj) {
return typeof obj === 'function';
};
function isDefined(value) {
return value !== undefined && value !== null;
}
exports.isFunction = isFunction;
function typeOf(value, type) {
return isDefined(value) && typeof value === type;
}
var isObject = function (obj) {
return typeof obj === 'object';
};
function isArray(value) {
return Array.isArray(value);
}
exports.isObject = isObject;
function isFunction(value) {
return typeOf(value, 'function');
}
var isString = function (obj) {
return typeof obj === 'string';
};
function isString(value) {
return typeOf(value, 'string');
}
exports.isString = isString;
function isObject(value) {
return typeOf(value, 'object') && !isFunction(value) && !isArray(value);
}

@@ -39,0 +39,0 @@ var isHTMLCollection = function (obj) {

{
"name": "@helpscout/cyan",
"version": "0.7.0",
"version": "0.8.0",
"description": "Cypress-like Testing for React + JSDOM",

@@ -58,2 +58,3 @@ "main": "dist/index.js",

"dependencies": {
"@types/react": "16.8.15",
"deepmerge": "3.2.0",

@@ -60,0 +61,0 @@ "delay": "4.2.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