-
Notifications
You must be signed in to change notification settings - Fork 46.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Run each test in its own <iframe> #1
Conversation
Fp.bind = function(context) { | ||
var func = this; | ||
var args = slice.call(arguments, 1); | ||
return args.length > 0 ? function() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ternary across this many lines is groosssss. Can you just use if
?
What about just using the shim @ https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/bind - this here is not quite the same.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, sure.
For what it's worth, the static_upstream
polyfill doesn't bother with constructor function binding, either. Seems like a nontrivial cost to pay for a minority use case.
These tests can still be run in the browser using `grunt test --debug`.
When the function to be bound does not have a prototype, ignore the constructor case.
A++, merge away when you're ready |
I like this much better than our current test system. But isn't it masking the fact that dumpCache() doesn't work consistently between our phantom and jstest test runners? I think that's why we had the original issue where the reactRoot count was not reset when running in phantom. Doesn't that mean that some tests will pass in phantom (because they're better isolated) and fail in jstest? |
@petehunt good question. I believe jstest actually creates a new window environment for each test, which would mean that the So I think/hope that we will have fewer disagreements between phantom and jstest. It's still masking the fact that cc @jeffmo who might know better |
Run each test in its own <iframe>
👍 |
Update ReactCompositeComponentNestedState-test.js
[Fiber] Refactor error boundaries in Fiber
* Remove PooledClass from FallbackCompositionState The only module that uses FallbackCompositonState is BeforeInputEventPlugin. The way its structured means there can only be a single instance of FallbackCompositionState at any given time (stored in a local variable at the top-level) so we don't really need pooling here at all. Instead, a single object is now stored in FallbackCompositionState, and access (initializing, reseting, getting data) is gaurded by the exported helper object. * Use new FallbackCompositionState API in BeforeInputEventPlugin * Implement event-specific pooling in SyntheticEvent * Remove PooledClass from TopLevelCallbackBookKeeping * Update results.json * Add pooled event test fixtures (#1) * Fix fixture lint
Update README.md
This is not blocking the initial launch, so feel free to put it on the back-burner for now.
The Jasmine test harness still runs in the parent window and reports to PhantomJS via
window.callPhantom
, but each test<iframe>
has its own copy ofreact-test.js
and each individual test module is required in the global context of a separate<iframe>
.This gives us a significant approximation of the benefits of mocking, at least in terms of isolating tests from one another.
cr @jeffmo @zpao