react and react-dom have both cjs and umd versions available.
Is it possible to create a umd version of react-test-renderer as well?
I'm curious, what would this be used for?
react and react-dom have UMD versions because it enables them to be run in a browser without any transform/bundling step. But the test renderer isn't really useful without a test runner, which should be capable of consuming the CJS build.
Thanks for the response!
I'm working in an environment where npm isn't allowed (among other things) -- so we use Jasmine Standalone (SpecRunner) on the browser for JS Unit Testing.
I was planning to create some wrappers around react-dom-test-utils, react-test-renderer and react-test-renderer-shallow to make the testing slightly less painful.
Gotcha.
If you're not using NPM to install, would you be willing to just create your own UMD test renderer bundle? It would be pretty simple:
diff --git a/scripts/rollup/bundles.js b/scripts/rollup/bundles.js
index 138017b5d..bcf99ae52 100644
--- a/scripts/rollup/bundles.js
+++ b/scripts/rollup/bundles.js
@@ -156,7 +156,7 @@ const bundles = [
/******* React Test Renderer *******/
{
label: 'test',
- bundleTypes: [FB_DEV, NODE_DEV, NODE_PROD],
+ bundleTypes: [UMD_DEV, UMD_PROD],
moduleType: RENDERER,
entry: 'react-test-renderer',
global: 'ReactTestRenderer',
yarn build -- test-renderer to build the renderer../build/dist/react-test-renderer.development.js
./build/dist/react-test-renderer.production.min.js
Should give you a bundle that exports a global ReactTestRenderer variable.
I guess it doesn't hurt us to add a UMD for it.
Sure. I'll toss up a PR for consideration.
Ok @srb101, the next release of the test renderer will have a UMD build. In the meanwhile, here you go:
Most helpful comment
Ok @srb101, the next release of the test renderer will have a UMD build. In the meanwhile, here you go:
react-test-renderer.production.min.jsreact-test-renderer.development.js