We have added a unit testing framework to Stencil. Stencil is a tool for building modern Web Components. Stencil combines some of the best features from traditional frameworks, but outputs 100% standards-compliant Custom Elements, part of the Web Component spec.
The goals we had when adding the testing framework were simple: make it easy to understand, and keep the API as small as possible. As a result of this, the testing API has a total of two methods: render() and flush().
render() – The render method takes an object containing a list of components that the Stencil compiler needs to know about and an HTML string. It returns the rendered element.
flush() – The flush method takes an element and causes it to rerender. This is typically done after properties on the element are changed.