Giter VIP home page Giter VIP logo

lit-element-tester's Introduction

Lit Element Tester

A framework that makes unit testing your custom elements built with Polymer/lit-element a breeze. This is an alternative to Google Web Component Tester.

Built with Mocha Headless Chrome.

Installation

npm install lit-element-tester -g

You may alternatively install the package locally with --save option and use npx utility to run it.

Highlights

  • Development mode with Google Chrome
  • Production mode that runs completely headless
  • Source map support for debugging
  • Code coverage
  • HTML fixtures

Note

Take note that Google Chrome is the only supported browser, and there is no plan to add support for other browsers.

HTML test runner template

lit-element-tester requires you to provide an HTML test runner that will get loaded in Chrome for testing.

Use the following as a template for your test runner: https://github.com/drochgenius/lit-element-tester/blob/master/test/runner.html

We expect this file to be located in a folder called /test at the top level of your project.

Usage

Look at the man page.

lit-element-tester -h

Server configuration

You must provide a server configuration file, see here for details. You can add some test-specific configuration in a LitElementTester section.

Example:

"LitElementTester": {
    "instrumentedFiles": ["dist/components/*.js", "dist/mixins/*.js"],
    "testClientContentPath": "test/runner.html",
    "disableLogging": true
}
  • instrumentedFiles: an array of globbing patterns to defines the files that need to be instrumented for code coverage.
  • testClientContentPath: the path to the HTML test runner.
  • disableLogging: set this to true to disable express logging.

Run tests

lit-element-tester

Develop tests

lit-element-tester -d

lit-element-tester's People

Contributors

dom-hmh-mtl avatar drochgenius avatar montrealist avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

lit-element-tester's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.