Skip to content

Commit 5f65ea1

Browse files
authored
Shallow renderer and test utils bundles (#9426)
Shallow renderer and test utils bundles Adds new bundles introduced with React 15.5 release to master (and 16 alpha) react-dom/test-utils: This new bundle contains what used to be react-addons-test-utils. This bundle shares things from react-dom rather than duplicates them. A temporary createRenderer method has been left behind as a way to access the new shallow renderer. This is for the ReactNative release cycle only and should be going away before the final release. react-test-renderer/shallow: This new shallow renderer is almost entirely stand-alone (in that it doesn't use the React reconciler or scheduler). The only touch points are ReactElement and prop/context validation. This renderer is stack and fiber compatible.
1 parent f3e4679 commit 5f65ea1

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
'use strict';
22

3-
module.exports = require('./cjs/react-test-renderer.development');
3+
if (process.env.NODE_ENV === 'production') {
4+
throw Error('test renderer is not available in production mode.');
5+
} else {
6+
module.exports = require('./cjs/react-test-renderer.development');
7+
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
"PATENTS",
2727
"README.md",
2828
"index.js",
29+
"shallow.js",
2930
"cjs/"
3031
]
3132
}

shallow.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
'use strict';
2+
3+
if (process.env.NODE_ENV === 'production') {
4+
throw Error('shallow renderer is not available in production mode.');
5+
} else {
6+
module.exports = require('./cjs/react-test-renderer-shallow.development');
7+
}

0 commit comments

Comments
 (0)