What if we could borrow react's end-to-end tests (or whatever high level tests they have that dont test internal methods) and use them as our own e2e tests?
Willing to make a PR for this.
That would be amazing. I was actually thinking about this last week. Curious to see if it would work!
I agree it鈥檚 a great idea, especially now that we have several libs claiming React compat.
These are interesting tests, some of which you might want to consider porting over:
Awesome, thanks Dan. Not sure if @amilajack is still interested, if not I can do the port!
Sorry for not delivering the PR. I'll definitely looking into this. I've just started my sophomore school of college so I've been a bit busy recently. But I'll definitely start working on this.
@amilajack no worries! I just didn't want to step on toes 馃槉

馃槀
@amilajack or @developit I'd love to help, but unfortunately I can't give any time 馃槚
I'd like to make a request though, could this be non-Preact specific? Could we instead develop a test spec that can be run against any implementation that claims to follow the React API? I've definitely tried writing my own JSX diffing/patching algorithms before and a suite like this would have been super helpful.
I believe a suite of Preact independent tests would not only raise Preact's claim of being a drop in React replacement, but also improve the quality of the entire JSX rendering ecosystem and perhaps even inviting more external contributors potentially including some more core React team members.
This would better allow the community to focus on _contracts_ and free the community to excitement with implementations.
A good example of this in the wild is the observable proposal's test suite: https://github.com/tc39/proposal-observable/tree/master/es-observable-tests
What about something like html acid tests?
I think I see where you're going with this. Could possibly this be the rise of informal standards for libraries? (a good thing IMO)
So theoretically these tests don't have to be tied into the DOM considering React is trying to decouple itself from the DOM. When Preact runs the suite it will need a DOM, but if React ran the suite it should be able to use say the test renderer or a native renderer as well as a DOM renderer.
See the tests @dan_abramov linked and how they are written, I'm not sure if they are DOM specific.
No, they鈥檙e not. I鈥檓 sure that DOM specifics will differ anyway (e.g. most impls don鈥檛 want to have event normalization like in React). I think what would be most valuable is to ensure that composite components, lifecycle, ref resolution, etc, works the same way.
We would obviously change React component model with time too. So unlike Promise A+ tests or similar, you can expect some churn with this. But if anything, having a shared test suite would help people to catch up with us, if they want to.
Yeah, and I know Preact doesn't support React.createClass, but the test suite should probably include it for completeness sake as there's still a lot of legacy code that depends on it (and it's somewhat easier for beginners). Preact could just opt-out of those tests (unless I missed something and Preact _can_ support createClass 馃槈).
FWIW we鈥檒l be separating createClass into a separate package. I don鈥檛 quite see the point of Preact reimplementing it because it should be usable as is鈥攊t just provides a class React can then use (and presumably its result would work with Preact as well).
@gaearon not sure how this slipped through my inbox, but modularizing createClass() sounds like a great idea. I'd be happy to switch preact-compat over to depending on that when available.
We switched our test suite to run against real browsers. This includes several e2e tests that assert the final DOM output after specific actions have occured :+1: :100: These tests are already in master so I think it's safe to close this issue :slightly_smiling_face:
Most helpful comment
FWIW we鈥檒l be separating
createClassinto a separate package. I don鈥檛 quite see the point of Preact reimplementing it because it should be usable as is鈥攊t just provides a class React can then use (and presumably its result would work with Preact as well).