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

@callstack/reassure-measure

Package Overview
Dependencies
Maintainers
8
Versions
24
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@callstack/reassure-measure - npm Package Compare versions

Comparing version 0.3.0 to 0.3.1

lib/commonjs/testingLibrary.js

24

lib/commonjs/config.js

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

exports.resetToDefault = resetToDefault;
let defaultRender;
let defaultCleanup;
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const RNTL = require('@testing-library/react-native');
defaultRender = RNTL.render;
defaultCleanup = RNTL.cleanup;
} catch (error) {
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const RTL = require('@testing-library/react');
defaultRender = RTL.render;
defaultCleanup = RTL.cleanup;
} catch (error) {
console.warn("Reassure: couldn't find neither @testing-library/react-native nor @testing-library/react");
}
}
const defaultConfig = {

@@ -36,4 +15,3 @@ runs: 10,

verbose: false,
render: defaultRender,
cleanup: defaultCleanup
testingLibrary: undefined
};

@@ -40,0 +18,0 @@ let config = defaultConfig;

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

var _testingLibrary = require("./testingLibrary");
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }

@@ -37,13 +39,7 @@

(0, _output.showFlagsOuputIfNeeded)();
const {
render,
cleanup
} = (0, _testingLibrary.resolveTestingLibrary)();
if (!_config.config.render) {
console.error('❌ Reassure: unable to find "render" function. Do you have "@testing-library/react-native" installed?');
throw new Error('Unable to find "render" function');
}
if (!_config.config.cleanup) {
console.error('❌ Reassure: unable to find "cleanup" function. Do you have "@testing-library/react-native" installed?');
throw new Error('Unable to find "cleanup" function');
}
for (let i = 0; i < runs + dropWorst; i += 1) {

@@ -65,3 +61,3 @@ var _global$gc, _global;

const screen = _config.config.render( /*#__PURE__*/React.createElement(React.Profiler, {
const screen = render( /*#__PURE__*/React.createElement(React.Profiler, {
id: "Test",

@@ -75,4 +71,3 @@ onRender: handleRender

_config.config.cleanup();
cleanup();
isFinished = true;

@@ -79,0 +74,0 @@ (_global$gc = (_global = global).gc) === null || _global$gc === void 0 ? void 0 : _global$gc.call(_global);

@@ -1,22 +0,1 @@

let defaultRender;
let defaultCleanup;
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const RNTL = require('@testing-library/react-native');
defaultRender = RNTL.render;
defaultCleanup = RNTL.cleanup;
} catch (error) {
try {
// eslint-disable-next-line import/no-extraneous-dependencies
const RTL = require('@testing-library/react');
defaultRender = RTL.render;
defaultCleanup = RTL.cleanup;
} catch (error) {
console.warn("Reassure: couldn't find neither @testing-library/react-native nor @testing-library/react");
}
}
const defaultConfig = {

@@ -27,4 +6,3 @@ runs: 10,

verbose: false,
render: defaultRender,
cleanup: defaultCleanup
testingLibrary: undefined
};

@@ -31,0 +9,0 @@ export let config = defaultConfig;

@@ -5,2 +5,3 @@ import * as React from 'react';

import { showFlagsOuputIfNeeded, writeTestStats } from './output';
import { resolveTestingLibrary } from './testingLibrary';
export async function measurePerformance(ui, options) {

@@ -20,13 +21,7 @@ const stats = await measureRender(ui, options);

showFlagsOuputIfNeeded();
const {
render,
cleanup
} = resolveTestingLibrary();
if (!config.render) {
console.error('❌ Reassure: unable to find "render" function. Do you have "@testing-library/react-native" installed?');
throw new Error('Unable to find "render" function');
}
if (!config.cleanup) {
console.error('❌ Reassure: unable to find "cleanup" function. Do you have "@testing-library/react-native" installed?');
throw new Error('Unable to find "cleanup" function');
}
for (let i = 0; i < runs + dropWorst; i += 1) {

@@ -48,3 +43,3 @@ var _global$gc, _global;

const screen = config.render( /*#__PURE__*/React.createElement(React.Profiler, {
const screen = render( /*#__PURE__*/React.createElement(React.Profiler, {
id: "Test",

@@ -58,3 +53,3 @@ onRender: handleRender

config.cleanup();
cleanup();
isFinished = true;

@@ -61,0 +56,0 @@ (_global$gc = (_global = global).gc) === null || _global$gc === void 0 ? void 0 : _global$gc.call(_global);

/// <reference types="react" />
declare type Render = (component: React.ReactElement<any>) => any;
declare type Cleanup = () => void;
export declare type TestingLibrary = 'react' | 'react-native' | {
render: Render;
cleanup: Cleanup;
};
export declare type Render = (component: React.ReactElement<any>) => any;
export declare type Cleanup = () => void;
declare type Config = {

@@ -9,4 +13,3 @@ runs: number;

verbose: boolean;
render?: Render;
cleanup?: Cleanup;
testingLibrary?: TestingLibrary;
};

@@ -13,0 +16,0 @@ export declare let config: Config;

export { configure, resetToDefault } from './config';
export { measurePerformance } from './measure';
export type { MeasureOptions } from './measure';
{
"name": "@callstack/reassure-measure",
"version": "0.3.0",
"version": "0.3.1",
"description": "Performance measurement library for React and React Native",

@@ -5,0 +5,0 @@ "main": "lib/commonjs/index",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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