Skip to content

seed project combining pika cli + typescript + web components + mocha testing

License

Notifications You must be signed in to change notification settings

zenwork/pika-mocha

Repository files navigation

ES6 Module Web Component Seed Project

I have built this in an attempt to keep things modern, simple, powerful, and agnostic.

Quick Start

  • On Mac OS X or on Linux run the following in a directory where you want to create a project.
wget -q -O /tmp/init.sh https://raw.githubusercontent.com/zenwork/pika-mocha/master/init.sh && sh /tmp/init.sh

Goal

The goal of this seed project is to build a simple tool-chain for ES6 module-based web components.

  • Publish and/or serve ES6 module based JS
  • Publish Typescript typings(*.d.ts files) to make this project a TS-compatible dependency.
  • Run tests against the same transpiled code that will be published
  • Be able to debug Typescript in the browser
  • Works in modern browsers

Stack

Seeded Artifacts

  • a simple example web componnent
  • simple tests
  • html pages to demo and test the various pkg artifacts

Usage

Install all dependencies.

npm install

To serve the content of the .serve directory.

npm run serve

Build the pkg directory only.

npm run build

Build the pkg and then the .serve directory .

npm run build:serve

Run build:serve on every source change.

npm run build:watch

Lint the code.

npm run lint

Testing

Run Headless tests with chromium.

npm run test:headless

Run headless tests in watch mode.

npm run test:watch

ES6 Module based tests

At the moment this setup only allows headless testing with chromium and on bundled code. ES6 Module based tests can be run in a regular browser.

How Live-Coding Works

Pika does not support a watch mode compatible with live-coding at the moment. So we have to jump through a few hoops.

  • serve content from .serve directory
  • run pika build which rebuilds everything into the pkg dir
  • rsync pkg to .serve so that only changed files are updated. This will then trigger es-dev-server to reload the page.

Todo

  • improve headless testing to run in a single watching process
  • compatible with IE 11 and Edge (pre-chromium integration)
  • sort out imports so using .js is not neccessary
  • maps not working in mocha test failures

About

seed project combining pika cli + typescript + web components + mocha testing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published