Karma test runner gets caught on Radium - karma-runner

Not sure how much help I'm going to get for this since it's pretty specific but I'm starting to run out of ideas.
I have a React + Redux + Webpack project in which I'm trying to setup Karma test-runner. I have a karma.conf.js file which looks like this:
var webpack = require('webpack');
module.exports = function (config) {
config.set({
browsers: [ 'Chrome' ],
singleRun: true,
frameworks: [ 'mocha' ],
files: [
'https://unpkg.com/locker.js#7.0.0/build/locker.min.js',
'**/*.js',
'tests.webpack.js'
],
preprocessors: {
'tests.webpack.js': [ 'webpack', 'sourcemap' ]
},
reporters: [ 'dots' ],
webpack: {
devtool: 'inline-source-map',
module: {
loaders: [
{ test: /\.js$/, loader: 'babel-loader' }
]
}
},
webpackServer: {
noInfo: true
}
});
};
When I run karma start I get the following output:
[BABEL] Note: The code generator has deoptimised the styling of "/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/jquery/dist/jquery.js" as it exceeds the max of "100KB".
Hash: 37479a38c85ee2483e4f
Version: webpack 1.13.3
Time: 13077ms
Asset Size Chunks Chunk Names
tests.webpack.js 4.32 MB 0 [emitted] tests.webpack.js
chunk {0} tests.webpack.js (tests.webpack.js) 1.35 MB [rendered]
[0] ./tests.webpack.js 330 bytes {0} [built]
[1] ./src -test\.js$ 195 bytes {0} [built]
[2] ./src/components/tests/app-test.js 879 bytes {0} [optional] [built]
[3] ./~/react/react.js 161 bytes {0} [built]
[4] ./~/react/lib/React.js 3.64 kB {0} [built]
[5] ./~/node-libs-browser/~/process/browser.js 8.04 kB {0} [built]
[6] ./~/object-assign/index.js 2.68 kB {0} [built]
[7] ./~/react/lib/ReactChildren.js 8.72 kB {0} [built]
[8] ./~/react/lib/PooledClass.js 5.46 kB {0} [built]
[9] ./~/react/lib/reactProdInvariant.js 1.51 kB {0} [built]
[10] ./~/fbjs/lib/invariant.js 1.74 kB {0} [built]
[11] ./~/react/lib/ReactElement.js 13.2 kB {0} [built]
[12] ./~/react/lib/ReactCurrentOwner.js 894 bytes {0} [built]
[13] ./~/fbjs/lib/warning.js 2.34 kB {0} [built]
[14] ./~/fbjs/lib/emptyFunction.js 1.5 kB {0} [built]
[15] ./~/react/lib/canDefineProperty.js 934 bytes {0} [built]
[16] ./~/react/lib/ReactElementSymbol.js 895 bytes {0} [built]
[17] ./~/react/lib/traverseAllChildren.js 8.49 kB {0} [built]
[18] ./~/react/lib/getIteratorFn.js 1.7 kB {0} [built]
[19] ./~/react/lib/KeyEscapeUtils.js 1.84 kB {0} [built]
[20] ./~/react/lib/ReactComponent.js 5.69 kB {0} [built]
[21] ./~/react/lib/ReactNoopUpdateQueue.js 3.87 kB {0} [built]
[22] ./~/fbjs/lib/emptyObject.js 709 bytes {0} [built]
[23] ./~/react/lib/ReactPureComponent.js 1.75 kB {0} [built]
[24] ./~/react/lib/ReactClass.js 29.9 kB {0} [built]
[25] ./~/react/lib/ReactPropTypeLocationNames.js 869 bytes {0} [built]
[26] ./~/react/lib/ReactDOMFactories.js 5.96 kB {0} [built]
[27] ./~/react/lib/ReactElementValidator.js 9.66 kB {0} [built]
[28] ./~/react/lib/ReactComponentTreeHook.js 14.4 kB {0} [built]
[29] ./~/react/lib/checkReactTypeSpec.js 5.13 kB {0} [built]
[30] ./~/react/lib/ReactPropTypesSecret.js 721 bytes {0} [built]
[31] ./~/react/lib/ReactPropTypes.js 19.5 kB {0} [built]
[32] ./~/react/lib/ReactVersion.js 456 bytes {0} [built]
[33] ./~/react/lib/onlyChild.js 1.58 kB {0} [built]
[34] ./~/expect/lib/index.js 745 bytes {0} [built]
[35] ./~/expect/lib/Expectation.js 15.7 kB {0} [built]
[36] ./~/has/src/index.js 234 bytes {0} [built]
[37] ./~/function-bind/index.js 231 bytes {0} [built]
[38] ./~/function-bind/implementation.js 2.05 kB {0} [built]
[39] ./~/tmatch/index.js 6.1 kB {0} [built]
[40] ./~/buffer/index.js 55.7 kB {0} [built]
[41] ./~/base64-js/index.js 5.22 kB {0} [built]
[42] ./~/ieee754/index.js 2.2 kB {0} [built]
[43] ./~/isarray/index.js 384 bytes {0} [built]
[44] ./~/expect/lib/assert.js 898 bytes {0} [built]
[45] ./~/object-inspect/index.js 11.1 kB {0} [built]
[46] ./~/expect/lib/SpyUtils.js 3.25 kB {0} [built]
[47] ./~/define-properties/index.js 3.08 kB {0} [built]
[48] ./~/object-keys/index.js 5.75 kB {0} [built]
[49] ./~/object-keys/isArguments.js 963 bytes {0} [built]
[50] ./~/foreach/index.js 944 bytes {0} [built]
[51] ./~/expect/lib/TestUtils.js 5.16 kB {0} [built]
[52] ./~/is-regex/index.js 1.64 kB {0} [built]
[53] ./~/is-equal/why.js 14.2 kB {0} [built]
[54] ./~/is-arrow-function/index.js 1.26 kB {0} [built]
[55] ./~/is-callable/index.js 2.81 kB {0} [built]
[56] ./~/is-boolean-object/index.js 1.76 kB {0} [built]
[57] ./~/is-date-object/index.js 1.68 kB {0} [built]
[58] ./~/is-generator-function/index.js 917 bytes {0} [built]
[59] ./~/is-number-object/index.js 1.75 kB {0} [built]
[60] ./~/is-string/index.js 1.7 kB {0} [built]
[61] ./~/is-symbol/index.js 1.9 kB {0} [built]
[62] ./~/is-equal/getSymbolIterator.js 678 bytes {0} [built]
[63] ./~/is-equal/getCollectionsForEach.js 638 bytes {0} [built]
[64] ./~/expect/lib/extend.js 574 bytes {0} [built]
[65] ./~/react-addons-test-utils/index.js 178 bytes {0} [built]
[66] ./~/react-dom/lib/ReactTestUtils.js 17.8 kB {0} [built]
[67] ./~/react-dom/lib/reactProdInvariant.js 1.51 kB {0} [built]
[68] ./~/react-dom/lib/EventConstants.js 2.39 kB {0} [built]
[69] ./~/react-dom/lib/EventPluginHub.js 10.2 kB {0} [built]
[70] ./~/react-dom/lib/EventPluginRegistry.js 11 kB {0} [built]
[71] ./~/react-dom/lib/EventPluginUtils.js 10.6 kB {0} [built]
[72] ./~/react-dom/lib/ReactErrorUtils.js 3.02 kB {0} [built]
[73] ./~/react-dom/lib/accumulateInto.js 1.96 kB {0} [built]
[74] ./~/react-dom/lib/forEachAccumulated.js 1.13 kB {0} [built]
[75] ./~/react-dom/lib/EventPropagators.js 7.45 kB {0} [built]
[76] ./~/react-dom/lib/ReactDOM.js 6.16 kB {0} [built]
[77] ./~/react-dom/lib/ReactDOMComponentTree.js 8.17 kB {0} [built]
[78] ./~/react-dom/lib/DOMProperty.js 9.03 kB {0} [built]
[79] ./~/react-dom/lib/ReactDOMComponentFlags.js 718 bytes {0} [built]
[80] ./~/react-dom/lib/ReactDefaultInjection.js 3.92 kB {0} [built]
[81] ./~/react-dom/lib/ARIADOMPropertyConfig.js 2.1 kB {0} [built]
[82] ./~/react-dom/lib/BeforeInputEventPlugin.js 17.6 kB {0} [built]
[83] ./~/fbjs/lib/ExecutionEnvironment.js 1.49 kB {0} [built]
[84] ./~/react-dom/lib/FallbackCompositionState.js 2.75 kB {0} [built]
[85] ./~/react-dom/lib/PooledClass.js 5.5 kB {0} [built]
[86] ./~/react-dom/lib/getTextContentAccessor.js 1.4 kB {0} [built]
[87] ./~/react-dom/lib/SyntheticCompositionEvent.js 1.59 kB {0} [built]
[88] ./~/react-dom/lib/SyntheticEvent.js 10.4 kB {0} [built]
[89] ./~/react-dom/lib/SyntheticInputEvent.js 1.54 kB {0} [built]
[90] ./~/react-dom/lib/ChangeEventPlugin.js 15.4 kB {0} [built]
[91] ./~/react-dom/lib/ReactUpdates.js 12.7 kB {0} [built]
[92] ./~/react-dom/lib/CallbackQueue.js 3.59 kB {0} [built]
[93] ./~/react-dom/lib/ReactFeatureFlags.js 902 bytes {0} [built]
[94] ./~/react-dom/lib/ReactReconciler.js 6.71 kB {0} [built]
[95] ./~/react-dom/lib/ReactRef.js 3.57 kB {0} [built]
[96] ./~/react-dom/lib/ReactOwner.js 3.98 kB {0} [built]
[97] ./~/react-dom/lib/ReactInstrumentation.js 862 bytes {0} [built]
[98] ./~/react-dom/lib/ReactDebugTool.js 17.4 kB {0} [built]
[99] ./~/react-dom/lib/ReactInvalidSetStateWarningHook.js 1.76 kB {0} [built]
[100] ./~/react-dom/lib/ReactHostOperationHistoryHook.js 1.24 kB {0} [built]
[101] ./~/fbjs/lib/performanceNow.js 1.1 kB {0} [built]
[102] ./~/fbjs/lib/performance.js 839 bytes {0} [built]
[103] ./~/react-dom/lib/Transaction.js 9.94 kB {0} [built]
[104] ./~/react-dom/lib/getEventTarget.js 1.27 kB {0} [built]
[105] ./~/react-dom/lib/isEventSupported.js 2.37 kB {0} [built]
[106] ./~/react-dom/lib/isTextInputElement.js 1.5 kB {0} [built]
[107] ./~/react-dom/lib/DefaultEventPluginOrder.js 1.37 kB {0} [built]
[108] ./~/react-dom/lib/EnterLeaveEventPlugin.js 3.61 kB {0} [built]
[109] ./~/react-dom/lib/SyntheticMouseEvent.js 2.62 kB {0} [built]
[110] ./~/react-dom/lib/SyntheticUIEvent.js 2.02 kB {0} [built]
[111] ./~/react-dom/lib/ViewportMetrics.js 893 bytes {0} [built]
[112] ./~/react-dom/lib/getEventModifierState.js 1.87 kB {0} [built]
[113] ./~/react-dom/lib/HTMLDOMPropertyConfig.js 6.63 kB {0} [built]
[114] ./~/react-dom/lib/ReactComponentBrowserEnvironment.js 1.23 kB {0} [built]
[115] ./~/react-dom/lib/DOMChildrenOperations.js 9.55 kB {0} [built]
[116] ./~/react-dom/lib/DOMLazyTree.js 5.54 kB {0} [built]
[117] ./~/react-dom/lib/DOMNamespaces.js 767 bytes {0} [built]
[118] ./~/react-dom/lib/setInnerHTML.js 4.77 kB {0} [built]
[119] ./~/react-dom/lib/createMicrosoftUnsafeLocalFunction.js 1.17 kB {0} [built]
[120] ./~/react-dom/lib/setTextContent.js 1.75 kB {0} [built]
[121] ./~/react-dom/lib/escapeTextContentForBrowser.js 4.07 kB {0} [built]
[122] ./~/react-dom/lib/Danger.js 2.52 kB {0} [built]
[123] ./~/fbjs/lib/createNodesFromMarkup.js 3.41 kB {0} [built]
[124] ./~/fbjs/lib/createArrayFromMixed.js 5.06 kB {0} [built]
[125] ./~/fbjs/lib/getMarkupWrap.js 4.44 kB {0} [built]
[126] ./~/react-dom/lib/ReactDOMIDOperations.js 1.27 kB {0} [built]
[127] ./~/react-dom/lib/ReactDOMComponent.js 44.5 kB {0} [built]
[128] ./~/react-dom/lib/AutoFocusUtils.js 881 bytes {0} [built]
[129] ./~/fbjs/lib/focusNode.js 949 bytes {0} [built]
[130] ./~/react-dom/lib/CSSPropertyOperations.js 9.99 kB {0} [built]
[131] ./~/react-dom/lib/CSSProperty.js 4.55 kB {0} [built]
[132] ./~/fbjs/lib/camelizeStyleName.js 1.42 kB {0} [built]
[133] ./~/fbjs/lib/camelize.js 1.1 kB {0} [built]
[134] ./~/react-dom/lib/dangerousStyleValue.js 3.63 kB {0} [built]
[135] ./~/fbjs/lib/hyphenateStyleName.js 1.39 kB {0} [built]
[136] ./~/fbjs/lib/hyphenate.js 1.2 kB {0} [built]
[137] ./~/fbjs/lib/memoizeStringOnly.js 967 bytes {0} [built]
[138] ./~/react-dom/lib/DOMPropertyOperations.js 9.02 kB {0} [built]
[139] ./~/react-dom/lib/quoteAttributeValueForBrowser.js 1.01 kB {0} [built]
[140] ./~/react-dom/lib/ReactBrowserEventEmitter.js 14.2 kB {0} [built]
[141] ./~/react-dom/lib/ReactEventEmitterMixin.js 1.44 kB {0} [built]
[142] ./~/react-dom/lib/getVendorPrefixedEventName.js 3.84 kB {0} [built]
[143] ./~/react-dom/lib/ReactDOMInput.js 13.9 kB {0} [built]
[144] ./~/react-dom/lib/LinkedValueUtils.js 6.65 kB {0} [built]
[145] ./~/react-dom/lib/ReactPropTypesSecret.js 725 bytes {0} [built]
[146] ./~/react-dom/lib/ReactDOMOption.js 4.34 kB {0} [built]
[147] ./~/react-dom/lib/ReactDOMSelect.js 8.51 kB {0} [built]
[148] ./~/react-dom/lib/ReactDOMTextarea.js 7.22 kB {0} [built]
[149] ./~/react-dom/lib/ReactMultiChild.js 16.5 kB {0} [built]
[150] ./~/react-dom/lib/ReactComponentEnvironment.js 1.78 kB {0} [built]
[151] ./~/react-dom/lib/ReactInstanceMap.js 1.51 kB {0} [built]
[152] ./~/react-dom/lib/ReactChildReconciler.js 6.79 kB {0} [built]
[153] ./~/react-dom/lib/instantiateReactComponent.js 6.12 kB {0} [built]
[154] ./~/react-dom/lib/ReactCompositeComponent.js 37.5 kB {0} [built]
[155] ./~/react-dom/lib/ReactNodeTypes.js 1.29 kB {0} [built]
[156] ./~/react-dom/lib/checkReactTypeSpec.js 5.15 kB {0} [built]
[157] ./~/react-dom/lib/ReactPropTypeLocationNames.js 873 bytes {0} [built]
[158] ./~/fbjs/lib/shallowEqual.js 2.64 kB {0} [built]
[159] ./~/react-dom/lib/shouldUpdateReactComponent.js 2.08 kB {0} [built]
[160] ./~/react-dom/lib/ReactEmptyComponent.js 1.39 kB {0} [built]
[161] ./~/react-dom/lib/ReactHostComponent.js 3.97 kB {0} [built]
[162] ./~/react-dom/lib/getNextDebugID.js 855 bytes {0} [built]
[163] ./~/react-dom/lib/KeyEscapeUtils.js 1.85 kB {0} [built]
[164] ./~/react-dom/lib/traverseAllChildren.js 8.52 kB {0} [built]
[165] ./~/react-dom/lib/ReactElementSymbol.js 899 bytes {0} [built]
[166] ./~/react-dom/lib/getIteratorFn.js 1.71 kB {0} [built]
[167] ./~/react-dom/lib/flattenChildren.js 3.74 kB {0} [built]
[168] ./~/react-dom/lib/ReactServerRenderingTransaction.js 3.22 kB {0} [built]
[169] ./~/react-dom/lib/ReactServerUpdateQueue.js 5.44 kB {0} [built]
[170] ./~/react-dom/lib/ReactUpdateQueue.js 10.3 kB {0} [built]
[171] ./~/react-dom/lib/validateDOMNesting.js 15.7 kB {0} [built]
[172] ./~/react-dom/lib/ReactDOMEmptyComponent.js 2.27 kB {0} [built]
[173] ./~/react-dom/lib/ReactDOMTreeTraversal.js 4.68 kB {0} [built]
[174] ./~/react-dom/lib/ReactDOMTextComponent.js 6.18 kB {0} [built]
[175] ./~/react-dom/lib/ReactDefaultBatchingStrategy.js 3.18 kB {0} [built]
[176] ./~/react-dom/lib/ReactEventListener.js 6.37 kB {0} [built]
[177] ./~/fbjs/lib/EventListener.js 2.93 kB {0} [built]
[178] ./~/fbjs/lib/getUnboundedScrollPosition.js 1.35 kB {0} [built]
[179] ./~/react-dom/lib/ReactInjection.js 1.47 kB {0} [built]
[180] ./~/react-dom/lib/ReactReconcileTransaction.js 6.55 kB {0} [built]
[181] ./~/react-dom/lib/ReactInputSelection.js 4.8 kB {0} [built]
[182] ./~/react-dom/lib/ReactDOMSelection.js 8.01 kB {0} [built]
[183] ./~/react-dom/lib/getNodeForCharacterOffset.js 2.25 kB {0} [built]
[184] ./~/fbjs/lib/containsNode.js 1.3 kB {0} [built]
[185] ./~/fbjs/lib/isTextNode.js 853 bytes {0} [built]
[186] ./~/fbjs/lib/isNode.js 1.25 kB {0} [built]
[187] ./~/fbjs/lib/getActiveElement.js 1.16 kB {0} [built]
[188] ./~/react-dom/lib/SVGDOMPropertyConfig.js 7.89 kB {0} [built]
[189] ./~/react-dom/lib/SelectEventPlugin.js 7.83 kB {0} [built]
[190] ./~/react-dom/lib/SimpleEventPlugin.js 9.62 kB {0} [built]
[191] ./~/react-dom/lib/SyntheticAnimationEvent.js 1.69 kB {0} [built]
[192] ./~/react-dom/lib/SyntheticClipboardEvent.js 1.66 kB {0} [built]
[193] ./~/react-dom/lib/SyntheticFocusEvent.js 1.52 kB {0} [built]
[194] ./~/react-dom/lib/SyntheticKeyboardEvent.js 3.2 kB {0} [built]
[195] ./~/react-dom/lib/getEventCharCode.js 1.78 kB {0} [built]
[196] ./~/react-dom/lib/getEventKey.js 3.44 kB {0} [built]
[197] ./~/react-dom/lib/SyntheticDragEvent.js 1.52 kB {0} [built]
[198] ./~/react-dom/lib/SyntheticTouchEvent.js 1.73 kB {0} [built]
[199] ./~/react-dom/lib/SyntheticTransitionEvent.js 1.71 kB {0} [built]
[200] ./~/react-dom/lib/SyntheticWheelEvent.js 2.4 kB {0} [built]
[201] ./~/react-dom/lib/ReactMount.js 29.3 kB {0} [built]
[202] ./~/react-dom/lib/ReactDOMContainerInfo.js 1.42 kB {0} [built]
[203] ./~/react-dom/lib/ReactDOMFeatureFlags.js 722 bytes {0} [built]
[204] ./~/react-dom/lib/ReactMarkupChecksum.js 2.1 kB {0} [built]
[205] ./~/react-dom/lib/adler32.js 1.56 kB {0} [built]
[206] ./~/react-dom/lib/ReactVersion.js 456 bytes {0} [built]
[207] ./~/react-dom/lib/findDOMNode.js 2.72 kB {0} [built]
[208] ./~/react-dom/lib/getHostComponentFromComposite.js 1.05 kB {0} [built]
[209] ./~/react-dom/lib/renderSubtreeIntoContainer.js 528 bytes {0} [built]
[210] ./~/react-dom/lib/ReactDOMUnknownPropertyHook.js 5.58 kB {0} [built]
[211] ./~/react-dom/lib/ReactDOMNullInputValuePropHook.js 2.08 kB {0} [built]
[212] ./~/react-dom/lib/ReactDOMInvalidARIAHook.js 4.32 kB {0} [built]
[213] ./~/react-dom/lib/ReactShallowRenderer.js 6.34 kB {0} [built]
[214] ./src/components/container.js 6.93 kB {0} [built] [1 error]
[216] ./~/color/index.js 11.9 kB {0} [built]
[217] ./~/clone/clone.js 5.24 kB {0} [built]
[218] (webpack)/buildin/module.js 361 bytes {0} [built]
[219] ./~/color-convert/index.js 2.73 kB {0} [built]
[220] ./~/color-convert/conversions.js 17.5 kB {0} [built]
[221] ./~/color-name/index.js 4.57 kB {0} [built]
[222] ./~/color-convert/route.js 3.03 kB {0} [built]
[223] ./~/color-string/color-string.js 8.65 kB {0} [built]
[224] ./src/components/input-bar.js 6.43 kB {0} [built]
[225] ./~/jquery/dist/jquery.js 219 kB {0} [built]
[226] ./src/components/message-list.js 10.6 kB {0} [built]
[227] ./src/components/loading-element.js 2.53 kB {0} [built]
[228] ./src/components/message-wrapper.js 3.1 kB {0} [built]
ERROR in ./~/radium/lib/index.js
Module build failed: ReferenceError: Unknown plugin "add-module-exports" specified in "/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/radium/.babelrc" at 0, attempted to resolve relative to "/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/radium"
at /Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/options/option-manager.js:176:17
at Array.map (native)
at Function.normalisePlugins (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/options/option-manager.js:154:20)
at OptionManager.mergeOptions (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/options/option-manager.js:229:36)
at OptionManager.init (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/options/option-manager.js:374:12)
at File.initOptions (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at transpile (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-loader/index.js:38:20)
at Object.module.exports (/Users/nicholashaley/Desktop/Work/Ada/chat/node_modules/babel-loader/index.js:131:12)
# ./src/components/container.js 13:14-31
28 11 2016 09:41:31.605:INFO [karma]: Karma v1.3.0 server started at http://localhost:9876/
28 11 2016 09:41:31.607:INFO [launcher]: Launching browser Chrome with unlimited concurrency
28 11 2016 09:41:31.635:INFO [launcher]: Starting browser Chrome
28 11 2016 09:41:32.479:INFO [Chrome 54.0.2840 (Mac OS X 10.12.1)]: Connected on socket /#HjnSrISArGmEs9oPAAAA with id 20278498
Chrome 54.0.2840 (Mac OS X 10.12.1) ERROR
Uncaught Invariant Violation: Minified React error #37; visit http://facebook.github.io/react/docs/error-decoder.html?invariant=37 for the full message or use the non-minified dev environment for full errors and additional helpful warnings.
at build/bundle.484e3c86.min.js:1
Chrome 54.0.2840 (Mac OS X 10.12.1): Executed 0 of 0 ERROR (1.667 secs / 0 secs)
28 11 2016 09:41:36.149:WARN [launcher]: Chrome was not killed in 2000 ms, sending SIGKILL.
It looks like Karma is getting caught up on the Radium module, which I am using for inline React styling. There is another error output near the bottom that also says Uncaught Invariant Violation: Minified React error #37. After following the error reference on facebook, the full error message is _registerComponent(...): Target container is not a DOM element. After googling this I still don't exactly understand what this means or how to fix it. It's possible it's just a side-effect of the Radium issue.
I have tried changing my root component to leave out Radium and the tests are able to run. I feel confident that this is an issue with Radium, but no idea how to fix this/work around it. Any suggestions would be very appreciated.

Related

Why open function forks when the given command is wrong?

In a Perl script, I want to execute a system command and write the output in the console. Here is a snippet who reproduce the behavior of my script:
use strict;
use warnings FATAL => 'all';
sub safe_run_cmd {
my ($cmd) = #_;
my $pid;
my $sleep_count;
my $fcmd;
do {
$pid = open($fcmd, "$cmd 2>&1 |");
unless(defined $pid) {
warn("Cannot fork: $!\n");
die("Bailing out\n") if $sleep_count++ > 6;
sleep(1);
}
} until (defined $pid);
if($pid) {
while ( my $line = <$fcmd> ) {
print $line;
}
close $fcmd;
} else {
exit(0);
}
print("End safe_run_cmd\n");
}
eval{safe_run_cmd("bad_command")};
print(`ps aux | egrep open`);
print("-----\n");
eval{safe_run_cmd("echo good_command")};
print(`ps aux | egrep open`);
I called the function safe because I follow what is described in the documentation.
If I run my script, I get this:
pierre 146161 21.0 0.0 21916 4548 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146163 0.0 0.0 21916 2816 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146164 0.0 0.0 4320 756 pts/1 S+ 14:32 0:00 sh -c ps aux | egrep open
pierre 146166 0.0 0.0 12752 1008 pts/1 S+ 14:32 0:00 grep -E open
-----
good_command
End safe_run_cmd
pierre 146161 10.5 0.0 21916 4548 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146163 0.0 0.0 21916 3516 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146168 0.0 0.0 4320 756 pts/1 S+ 14:32 0:00 sh -c ps aux | egrep open
pierre 146170 0.0 0.0 12752 996 pts/1 S+ 14:32 0:00 grep -E open
End safe_run_cmd
pierre 146161 10.5 0.0 21916 4744 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146171 0.0 0.0 4320 708 pts/1 S+ 14:32 0:00 sh -c ps aux | egrep open
pierre 146173 0.0 0.0 12752 1008 pts/1 S+ 14:32 0:00 grep -E open
-----
good_command
End safe_run_cmd
pierre 146161 10.5 0.0 21916 4744 pts/1 S+ 14:32 0:00 perl open.pl
pierre 146175 0.0 0.0 4320 788 pts/1 S+ 14:32 0:00 sh -c ps aux | egrep open
pierre 146177 0.0 0.0 12752 1012 pts/1 S+ 14:32 0:00 grep -E open
We can see, when I print the list of the processes after running the bad command, I have two perl forks. When the first one ends, the second one continue from the call of open. But, when the command is right, open doesn't fork.
What can I do to avoid this fork (or to manage it) and to display an error message when the command is bad?
The use of warnings FATAL => 'all' has a side-effect on the open function. Indeed, if open gets a warning, it immediately dies. So, if I remove it from the code, I get a correct output:
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
Cannot fork: No such file or directory
pierre 207725 2.3 0.0 21644 4432 pts/1 S+ 15:28 0:00 perl open.pl
pierre 207750 0.0 0.0 4320 816 pts/1 S+ 15:28 0:00 sh -c ps aux | egrep open
pierre 207752 0.0 0.0 12752 984 pts/1 S+ 15:28 0:00 grep -E open
-----
good_command
End safe_run_cmd
pierre 207725 2.3 0.0 21644 4448 pts/1 S+ 15:28 0:00 perl open.pl
pierre 207754 0.0 0.0 4320 748 pts/1 S+ 15:28 0:00 sh -c ps aux | egrep open
pierre 207756 0.0 0.0 12752 996 pts/1 S+ 15:28 0:00 grep -E open
To automaticly die if the command doesn't exist, it is possible to use autodie instead of the do block:
sub safe_run_cmd {
my ($cmd) = #_;
my $pid;
my $sleep_count;
my $fcmd;
use autodie;
$pid = open($fcmd, "$cmd 2>&1 |");
while ( my $line = <$fcmd> ) {
print $line;
}
close $fcmd;
print("End safe_run_cmd\n");
}
I get:
pierre 211968 11.5 0.0 26544 7244 pts/1 S+ 15:32 0:00 perl open.pl
pierre 211971 0.0 0.0 4320 768 pts/1 S+ 15:32 0:00 sh -c ps aux | egrep open
pierre 211973 0.0 0.0 12752 1064 pts/1 S+ 15:32 0:00 grep -E open
-----
good_command
End safe_run_cmd
pierre 211968 11.5 0.0 26544 7264 pts/1 S+ 15:32 0:00 perl open.pl
pierre 211975 0.0 0.0 4320 792 pts/1 S+ 15:32 0:00 sh -c ps aux | egrep open
pierre 211977 0.0 0.0 12752 1032 pts/1 S+ 15:32 0:00 grep -E open

prevent globbing of argument to bash script

I want to invoke the "find" command inside myscript, using the arguments that I pass to myscript. But if I use wildcard characters with the "-name" argument and any file happens to match the string, the string is expanded to all the filenames, no matter what kind of "quotes" I 'use'.
In the shell, I want globbing, but not when I pass arguments to this script. Example:
~/u/tmp/JNK> ls -latTr
total 32
drwxr-xr-x 160 BNW staff 5440 Jan 27 18:47:37 2018 ../
-rw-r--r-- 1 BNW staff 0 Jan 27 19:30:10 2018 Henry-James.txt
-rw-r--r-- 1 BNW staff 0 Jan 27 19:30:17 2018 Emily-Dickinson.txt
-rw-r--r-- 1 BNW staff 0 Jan 27 19:30:21 2018 for-Henry-James.txt
-rwxr-xr-x 1 BNW staff 97 Jan 27 19:31:55 2018 myscript*
-rw-r--r--# 1 BNW staff 6148 Jan 27 19:43:15 2018 .DS_Store
drwxr-xr-x 2 BNW staff 68 Jan 27 19:44:51 2018 DIRECTORY/
lrwxr-xr-x 1 BNW staff 19 Jan 27 19:45:09 2018 softlink# -> for-Henry-James.txt
drwxr-xr-x 9 BNW staff 306 Jan 27 19:45:09 2018 ./
~/u/tmp/JNK> find . -type f
./.DS_Store
./Emily-Dickinson.txt
./for-Henry-James.txt
./Henry-James.txt
./myscript
~/u/tmp/JNK> find . -type f -name "*James*"
./for-Henry-James.txt
./Henry-James.txt
~/u/tmp/JNK> cat myscript
#!/bin/bash
for arg in $#
do
printf '%s' "arg="
printf '%s' "$arg"
printf '\n'
done
find . $#
~/u/tmp/JNK> ./myscript -type f
arg=-type
arg=f
./.DS_Store
./Emily-Dickinson.txt
./for-Henry-James.txt
./Henry-James.txt
./myscript
~/u/tmp/JNK> ./myscript -type f -name "*James*"
arg=-type
arg=f
arg=-name
arg=Henry-James.txt
arg=for-Henry-James.txt
find: for-Henry-James.txt: unknown primary or operator
~/u/tmp/JNK> ./myscript -type f -name '*James*'
arg=-type
arg=f
arg=-name
arg=Henry-James.txt
arg=for-Henry-James.txt
find: for-Henry-James.txt: unknown primary or operator
~/u/tmp/JNK>
Is there an elegant solution?
The solution appears to be to add one line
set -o noglob
to the script. Now we have
#!/bin/bash
set -o noglob
for arg in $#
do
printf '%s' "arg="
printf '%s' "$arg"
printf '\n'
done
find . $#
and
~/u/tmp/JNK> ./myscript -name "*Jam*"
arg=-name
arg=*Jam*
./for-Henry-James.txt
./Henry-James.txt
~/u/tmp/JNK>

Extract data from a binary file

I have a binary file. I want extract all data from $marker + $step to $marker (or end of file).
Data example:
23 40 92 34 32 09 84 39 02 89 30 fe 90 38 01 02 03 f1 f2 00 00 00 22 33 44 56 77 22 aa bb cc dd ee ff 00 11 ff dd cc cc cc 22 80 ee 01 02 03 f1 f2 00 00 00 22 33 44 56 23 40 92 34 32 dd cc cc 22 33 44 22 33 44 01 02 03 f1 f2 00 00 00 22 33 44 56 77 22 FF FF FF 52 FF FF 52 00 00 00 00 00 00 00
It contains three blocks. I need:
1
00 00 00 22 33 44 56 77 22 aa bb cc dd ee ff 00 11 ff dd cc cc cc 22 80 ee
2
00 00 00 22 33 44 56 23 40 92 34 32 dd cc cc 22 33 44 22 33 44
3
00 00 00 22 33 44 56 77 22 FF FF FF 52 FF FF 52 00 00 00 00 00 00 00
I never worked with binary files with Perl.
$filename = $ARGV[0];
$marker = \x01\x02\x03\xf1\xf2;
$step = 3;
$count = 0;
open $file
while <$file> {
seek $marker;
Go to forward +$step bytes;
$count++
print EXTFILE_.$count.'.dat' $_
# Until do not seek new $marker or EOF
}
close file
As a result, I have to get three .dat files.
How can I realize this pseudocode? What would be some simple example?
Perl regular expressions are just as happy with binary data as with readable text, and binary files can be opened with a mode of raw to avoid translating line endings.
Here's a solution that reads the whole file into memory and scans it for the marker string.
use strict;
use warnings;
my $filename = shift;
my $binary = do {
open my $fh, '<:raw', $filename or die $!;
local $/;
<$fh>;
};
my $marker = "\x01\x02\x03\xf1\xf2";
while ( $binary =~ /$marker(.*?)(?=$marker|\z)/sg ) {
my #hex = map { sprintf '%02X', $_ } unpack 'C*', $1;
print "#hex\n";
}
Output
00 00 00 22 33 44 56 77 22 AA BB CC DD EE FF 00 11 FF DD CC CC CC 22 80 EE
00 00 00 22 33 44 56 23 40 92 34 32 DD CC CC 22 33 44 22 33 44
00 00 00 22 33 44 56 77 22 FF FF FF 52 FF FF 52 00 00 00 00 00 00 00
If the file is huge, or if you simply prefer the idea, you could set the input record separator to the marker string. Then a readline operation on the file would fetch up to and including the next occurrence of the marker pattern in the file. It means that each record is being read along with the marker from the beginning of the next record, but as it's going to be removed anyway it doesn't matter.
use strict;
use warnings;
my $filename = shift;
my $marker = "\x01\x02\x03\xf1\xf2";
open my $fh, '<:raw', $filename or die $!;
local $/ = $marker;
<$fh>; # Drop the data up to and including the first marker
while (<$fh>) {
chomp; # Remove the marker string from the end, if any
my #hex = map { sprintf '%02X', $_ } unpack 'C*';
print "#hex\n";
}
The output is identical to that of the program above.
Though that doesn't work for the required output of the program. This program uses the second technique above but writes to a series of EXTFILE.dat files instead of dumping the hex data. Note that an open mode of raw is necessary again.
use strict;
use warnings;
my $filename = shift // 'file.bin';
my $marker = "\x01\x02\x03\xf1\xf2";
open my $fh, '<:raw', $filename or die $!;
local $/ = $marker;
<$fh>; # Drop the data up to and including the first marker
my $count;
while (my $record = <$fh>) {
chomp $record;
my $outfile = sprintf 'EXTFILE_%d.dat', ++$count;
open my $out_fh, '>:raw', $outfile or die $!;
print $out_fh $record;
close $out_fh or die $!;
}

why the following code not printing the common unique values from the two files [duplicate]

I have two files myresult and annotation. data in the two files appear to be as range but they are not, that's why i cant store it in an array and i need to use split operator so that i can use it in a for loop and compare. now i need to print all common values from $i(myresult) and $j(annotation) without repetition (unique). i am not getting which condition and how to implement it so as to get desired output. i tried using %hash but could not able to implement.
myresult
0..351
12..363
24..375
36..387
48..399
60..411
.
.
annotation
272..1042
1649..2629
3436..4752
4793..4975
5408..6022
6025..6252
.
.
CODE:
#!/usr/bin/perl
open( $inp0, "<myresult" ) or die "not found";
open( $inp2, "<annotation" ) or die "not found";
open( $out, ">output" );
my #arr2 = <$inp0>;
my #arr4 = <$inp2>;
my $sum1 = 0;
foreach my $line1 (#arr2) {
my ( $from1, $to1 ) = split( /\.\./, $line1 );
foreach my $line2 (#arr4) {
my ( $from2, $to2 ) = split( /\.\./, $line2 );
for ( my $i = $from1; $i <= $to1; $i++ ) {
for ( my $j = $from2; $j <= $to2; $j++ ) {
if ( $i == $j ) {
print $out "$i \n";
$sum1++;
}
}
}
}
}
print "Unique values = $sum1";
You don't need to iterate over both the arrays. If the starting points of the ranges are ascending, you can use the following code:
#!/usr/bin/perl
use warnings;
use strict;
my #result = qw( 4..20 8..12 14..22 22..29 27..29 28..35 40..50 );
my #annot = qw( 1..5 11..13 25..37 45..55 );
my $from = (split /\.\./, $result[0])[0];
my $to = (split /\.\./, $result[-1])[1];
for my $i ($from .. $to) {
print "$i\n" if grep inside($i, $_), #result
and grep inside($i, $_), #annot;
}
sub inside {
my ($i, $range) = #_;
my ($from, $to) = split /\.\./, $range;
return ($from <= $i and $i <= $to)
}
Translate each data set into an array of values.
Then use a hash to count the matched uniq values from both lists:
#!/usr/bin/perl -w
use strict;
use warnings;
use autodie;
use List::MoreUtils qw(uniq);
my #result = do {
#open my $fh, '<', "myresult";
open my $fh, '<', \ "0..351\n12..363\n24..375\n36..387\n48..399\n60..411\n";
map { my ( $min, $max ) = /\d+/g; ( $min .. $max ) } <$fh>;
};
my #annot = do {
#open my $fh, '<', "myresult";
open my $fh, '<', \ "272..1042\n1649..2629\n3436..4752\n4793..4975\n5408..6022\n6025..6252\n";
map { my ( $min, $max ) = /\d+/g; ( $min .. $max ) } <$fh>;
};
my %count;
$count{$_}++ for uniq(#result), uniq(#annot);
print join( ' ', sort { $a <=> $b } grep { $count{$_} == 2 } keys %count ), "\n";
Outputs:
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411

Print unique values in FOR loop

I have two files myresult and annotation. data in the two files appear to be as range but they are not, that's why i cant store it in an array and i need to use split operator so that i can use it in a for loop and compare. now i need to print all common values from $i(myresult) and $j(annotation) without repetition (unique). i am not getting which condition and how to implement it so as to get desired output. i tried using %hash but could not able to implement.
myresult
0..351
12..363
24..375
36..387
48..399
60..411
.
.
annotation
272..1042
1649..2629
3436..4752
4793..4975
5408..6022
6025..6252
.
.
CODE:
#!/usr/bin/perl
open( $inp0, "<myresult" ) or die "not found";
open( $inp2, "<annotation" ) or die "not found";
open( $out, ">output" );
my #arr2 = <$inp0>;
my #arr4 = <$inp2>;
my $sum1 = 0;
foreach my $line1 (#arr2) {
my ( $from1, $to1 ) = split( /\.\./, $line1 );
foreach my $line2 (#arr4) {
my ( $from2, $to2 ) = split( /\.\./, $line2 );
for ( my $i = $from1; $i <= $to1; $i++ ) {
for ( my $j = $from2; $j <= $to2; $j++ ) {
if ( $i == $j ) {
print $out "$i \n";
$sum1++;
}
}
}
}
}
print "Unique values = $sum1";
You don't need to iterate over both the arrays. If the starting points of the ranges are ascending, you can use the following code:
#!/usr/bin/perl
use warnings;
use strict;
my #result = qw( 4..20 8..12 14..22 22..29 27..29 28..35 40..50 );
my #annot = qw( 1..5 11..13 25..37 45..55 );
my $from = (split /\.\./, $result[0])[0];
my $to = (split /\.\./, $result[-1])[1];
for my $i ($from .. $to) {
print "$i\n" if grep inside($i, $_), #result
and grep inside($i, $_), #annot;
}
sub inside {
my ($i, $range) = #_;
my ($from, $to) = split /\.\./, $range;
return ($from <= $i and $i <= $to)
}
Translate each data set into an array of values.
Then use a hash to count the matched uniq values from both lists:
#!/usr/bin/perl -w
use strict;
use warnings;
use autodie;
use List::MoreUtils qw(uniq);
my #result = do {
#open my $fh, '<', "myresult";
open my $fh, '<', \ "0..351\n12..363\n24..375\n36..387\n48..399\n60..411\n";
map { my ( $min, $max ) = /\d+/g; ( $min .. $max ) } <$fh>;
};
my #annot = do {
#open my $fh, '<', "myresult";
open my $fh, '<', \ "272..1042\n1649..2629\n3436..4752\n4793..4975\n5408..6022\n6025..6252\n";
map { my ( $min, $max ) = /\d+/g; ( $min .. $max ) } <$fh>;
};
my %count;
$count{$_}++ for uniq(#result), uniq(#annot);
print join( ' ', sort { $a <=> $b } grep { $count{$_} == 2 } keys %count ), "\n";
Outputs:
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411