Registry / testing / skin-deep

skin-deep

JSON →
library1.2.0jsnpmunverified

Skin-Deep provides testing helpers built on top of React's shallow rendering test utilities. Its primary goal is to offer higher-level functionality for unit testing React components, allowing developers to assert on a component's rendered output without fully mounting it or its children. The current stable version is 1.2.0. This library was designed to work with React versions 0.14 and above, requiring specific React testing utility packages depending on the React version (e.g., `react-addons-test-utils` for <15.5 or `react-test-renderer` for >=15.5). Skin-Deep offers methods to extract portions of the rendered tree, trigger events, and dive into sub-trees, providing a structured way to interact with a shallow-rendered component's virtual DOM. Its release cadence is effectively inactive, with the last update several years ago, making it unsuitable for modern React applications (React 18+).

npm install skin-deep
INSTALL
IMPORT
SIG · SKIN-DEEP
S
skin-deep
testingjavascriptv1.2.0
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

shallowRender
import { shallowRender } from 'skin-deep'; // Or import * as sd from 'skin-deep'; sd.shallowRender(...)
const shallowRender = require('skin-deep').shallowRender;
The primary `shallowRender` function is exposed as a named export. The CommonJS usage `var sd = require('skin-deep'); var tree = sd.shallowRender(...);` implies `shallowRender` is a property of the main module object.
exact
import { exact } from 'skin-deep';
const exact = require('skin-deep').exact;
Utility function for creating exact prop matchers in `subTree` or `everySubTree`.
hasClass
import { hasClass } from 'skin-deep';
const hasClass = require('skin-deep').hasClass;
Helper function for checking CSS classes on a rendered node.

This quickstart demonstrates how to shallow render a React component using `skin-deep`, then extract a specific sub-tree based on a selector and prop matcher, and finally perform assertions on its type, props, and text content.

import React from 'react'; import * as sd from 'skin-deep'; import assert from 'assert'; // Define a simple React component class MyComponent extends React.Component { render() { return ( <ul> <li><a href="/">Home</a></li> <li><a href="/abc">Draw</a></li> <li><a href="/def">Away</a></li> </ul> ); } } // Shallow render the component const tree = sd.shallowRender(<MyComponent />); // Find a specific sub-tree using a selector and matcher const homeLink = tree.subTree('a', { href: '/' }); // Assertions on the extracted sub-tree assert.equal(homeLink.type, 'a'); assert.equal(homeLink.props.href, '/'); assert.equal(homeLink.text(), 'Home'); console.log('Shallow rendering and assertions successful!');
Debug
Known issues
breakingReact 0.13 is no longer supported since Skin-Deep v1.0. If you are using an older React version, you must remain on Skin-Deep < 1.0.
fix
Upgrade React to 0.14 or newer, or downgrade `skin-deep` to a compatible version (e.g., 0.x).
affects: >=1.0.0
breakingThe `subTreeLike` and `everySubTreeLike` methods were renamed to `subTree` and `everySubTree` respectively in Skin-Deep v1.0.
fix
Update method calls from `subTreeLike` to `subTree` and `everySubTreeLike` to `everySubTree`.
affects: >=1.0.0
breakingSeveral methods including `findNode`, `textIn`, `fillField`, `findComponent`, and `findComponentLike` were removed in Skin-Deep v1.0.
fix
Replace `findNode`, `findComponent`, `findComponentLike` with `subTree()`. Use `subTree().text()` instead of `textIn()`. For `fillField`, directly use `subTree().props.onChange`.
affects: >=1.0.0
breakingThe `toString()` method's output changed significantly in v1.0, moving from HTML string rendering to a pretty-printed representation of the render result.
fix
Review any tests asserting on the `toString()` output and update expectations to match the new pretty-printed format. If HTML rendering is strictly required, explore alternative React testing utilities.
affects: >=1.0.0
breakingThe `reRender()` method now accepts `props` as its argument instead of a full `ReactElement`.
fix
Adjust calls to `reRender()` to pass only the props object, e.g., `tree.reRender({ newProp: 'value' })` instead of `tree.reRender(<MyComponent newProp='value' />)`.
affects: >=1.0.0
gotchaSkin-Deep's development has been inactive for several years (last published 8 years ago as of 2026), making it incompatible with modern React versions like React 18+ and their concurrent rendering features. Using it with recent React versions will likely lead to unexpected behavior or errors.
fix
Consider migrating to actively maintained React testing libraries such as `@testing-library/react` or Enzyme (though Enzyme itself is seeing less active development compared to React Testing Library), which offer better support for modern React features and APIs.
affects: >=1.2.0 (effectively, any React > 16)
Errors
Common errors & fixes
TypeError: tree.subTreeLike is not a function
Attempting to use the old `subTreeLike` method after upgrading to `skin-deep` v1.0 or later.
fix
Rename `subTreeLike` to `subTree` in your test code: `tree.subTree(...)`.
TypeError: Cannot read properties of undefined (reading 'textIn')
Using the deprecated `textIn` method which was removed in `skin-deep` v1.0.
fix
Use `subTree().text()` instead: `tree.subTree('.some-selector').text()`.
Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
This error can occur when using `skin-deep` with modern React if `createClass` components are mixed with functional or class components, or if the React version is too new for the `react-test-renderer` version being used implicitly by `skin-deep`.
fix
Ensure you are using `skin-deep` with a compatible React version (<= React 16 is generally safer). For modern React (17+), consider migrating to `@testing-library/react` which is actively maintained and designed for current React APIs.
Upgrade
Version history
1.2.0latest on npm
Audit
Dependencies
reactrequiredCore React library required for component definition and rendering.
react-addons-test-utilsoptionalRequired for React < 15.5 to provide shallow rendering capabilities.
react-domoptionalRequired for React >= 15.5, though the shallow rendering is handled by react-test-renderer.
react-test-rendereroptionalRequired for React >= 15.5 to provide shallow rendering capabilities.
Agent activity
3 hits · last 30 days
node
2
Resources
skin-deep — npm install skin-deep · libregistry