Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cy2

Package Overview
Dependencies
Maintainers
1
Versions
71
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cy2 - npm Package Compare versions

Comparing version 3.1.5 to 3.1.7

dist/path.d.ts

18

dist/__tests__/ast.spec.js
"use strict";
var _js = require("../js");
var _path = require("../path");
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {

@@ -32,2 +33,3 @@ try {

}
// jest.mock('../path');
const nonPatchedFile = `

@@ -51,7 +53,7 @@ process.env.CYPRESS_INTERNAL_ENV =

process.env.CYPRESS_INTERNAL_ENV || "production";
require("./packages/server");
require('./packages/server');
`;
const result = `(function ${_js.FN_ID}() {
const result = (path = 'foo')=>`(function ${_js.FN_ID}() {
try {
require('foo');
require('${path}');
} catch (e) {

@@ -61,3 +63,4 @@ }

process.env.CYPRESS_INTERNAL_ENV = process.env.CYPRESS_INTERNAL_ENV || 'production';
require('./packages/server');`;
require('./packages/server');`
;
test('should return false for non-injected code', ()=>{

@@ -70,6 +73,9 @@ expect((0, _js).hasInjected((0, _js).parseJS(nonPatchedFile))).toEqual(false);

test('should inject new code', _asyncToGenerator(function*() {
expect((0, _js).instrumentCypressInit(nonPatchedFile, 'foo')).toEqual(result);
expect((0, _js).instrumentCypressInit(nonPatchedFile, 'foo')).toEqual(result());
}));
test('should replace existing code', _asyncToGenerator(function*() {
expect((0, _js).instrumentCypressInit(patchedFile, 'foo')).toEqual(result);
expect((0, _js).instrumentCypressInit(patchedFile, 'foo')).toEqual(result());
}));
test('should inject new code for windows path', _asyncToGenerator(function*() {
expect((0, _js).instrumentCypressInit(nonPatchedFile, 'C:\\Users\\Administrator\\Desktop\\node_modules\\cy2\\dist/injected.js')).toEqual(result((0, _path).normalizePath('C:\\Users\\Administrator\\Desktop\\node_modules\\cy2\\dist/injected.js')));
}));

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

var _estraverse = _interopRequireDefault(require("estraverse"));
var _path = require("./path");
function _interopRequireDefault(obj) {

@@ -21,5 +22,3 @@ return obj && obj.__esModule ? obj : {

exports.parseJS = parseJS;
const generateJS = (ast)=>_escodegen.default.generate(ast, {
verbatim: 'raw'
})
const generateJS = (ast)=>_escodegen.default.generate(ast)
;

@@ -30,5 +29,6 @@ exports.generateJS = generateJS;

const instrumentCypressInit = (code, injectedModulePath)=>{
const normalizedPath = (0, _path).normalizePath(injectedModulePath);
const injectedFn = `
function ${FN_ID}() {
try { require('${injectedModulePath}'); }
try { require('${normalizedPath}'); }
catch (e) {}

@@ -35,0 +35,0 @@ }`;

{
"name": "cy2",
"version": "3.1.5",
"version": "3.1.7",
"author": "Andrew Goldis",

@@ -29,3 +29,4 @@ "main": "./dist",

"js-yaml": "^4.1.0",
"npm-which": "^3.0.1"
"npm-which": "^3.0.1",
"slash": "3.0.0"
},

@@ -32,0 +33,0 @@ "files": [

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