liveBook · Manning

Karma

As explained in Web Components in Action

Karma is a JavaScript test runner that executes tests in real browsers or other browser-like environments.

Karma is a JavaScript test runner that executes tests in browsers. It preserves Mocha and Chai tests while replacing Selenium, but requires configuration and plugins for frameworks, browser launchers, and preprocessing. section 13.3

Testing a Web Component

A JavaScript-only test creates a container, loads a module, inserts a <wcia-slider> element, and asserts its value, attribute, and rendered thumb position. The same suite can run through a Karma Web Components plugin and HTML fixture.

How Web Components in Action covers it

How deep it goes
Builds configuration from installation through browser launchers, preprocessing, fixtures, and headless execution.
Examples
Uses slider component tests, npm installation commands, Karma configuration files, and browser-runner pages.
What it assumes
Assumes JavaScript testing with Mocha and Chai, then adds Karma plugins and module preprocessing.
What you can do after
Operate/configure Karma to run component tests in Chrome, Firefox, or Safari, including headless modes.
How it connects
Connects Mocha, Chai, Rollup, Web Components, Selenium, and browser launchers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Web Components in Action. The section links point to the parts of the book it draws on.