ensure that test fails React's Invariant Violation if components are swapped out from under the root; also lots of miscellaneous surgery to avoid jsdom's Wrong Document.