Hacker News new | past | comments | ask | show | jobs | submit login

Yeah, "no DOM in tests" is actually a pretty good mantra.

Code that is just inspecting the DOM to find elements, or to do stuff to them that is just working up to the state where you can actually test something, should be in some shared object/library, but that is as easy as:

    import { Whatever } from '/foo/bar';
Having that kind of code outside of the test probably makes the introductory "test hello world" example more complicated, but I think it's definitely a good practice in the real world, and isn't documented well.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: